Added a bit more of the algorithm -- almost there.