Did Sherlock do right by Randy?

Sherlock had a rough time with Randy in this episode. Did Sherlock do everything he could to help or could he have done more?
Added:

How does this episode rate amongst the rest of Elementary Season 2?

How does Elementary Season 2 Episode 13 rate amongst the preceding Elementary Season 2 episodes?
Added:

Elementary Quotes

Holmes: Why do you suppose you hate your job so much?
Watson: I don't hate my job.
Holmes: You have two alarm clocks. No one with two alarm clocks loves their job. Two alarm clocks mean it's a chore for you to get up in the morning.

Watson: How do you do it, guess things?
Sherlock: I observe and then I deduce.
Watson: How did you know I was a doctor, you said you could tell from my hands.
Sherlock: Hand, singular. It was soft no calluses.
Watson: How did you know my father had an affair?
Sherlock: Google. Not everything is deducible.