How to cite the original source of an algorithm and a secondary source that provides a clearer description of the algorithm? I had a situation where for a particular algorithm, it first shows up in a paper [1]. 
This makes [1] a primary source.
I found [1] a bit hard reading when it came to describing the implementation and fine details of the algorithm. But it was good at describing why the algorithm was needed.

I found another work, which was a masters thesis [2].
It included a step by step mathematical working from what was in [1] (and [2] cited [1] appropriately).
It helped me a lot. I could have done the mathematical working myself, but didn't.

So I am writing a brief summery of the Algorithm:


  The {{Foo}} algorithm allows the {{Bar}} problem to be solved [1]. It
  is based on the fact that {{Equation}} holds under {{Conditions}} [2].
  {{My own explanation of {{Foo}} here}}


Is this correct?
Something like this should be OK:


  The Bar problem can be solved using the Foo algorithm [1], which is based on
  the fact that Equation holds under Conditions. A useful and detailed exposition of the Foo algorithm and how to implement it in practice can be found in [2].