Refactoring. Unit tests still pass.

Clean up code.
Clarify recursion.
Improving documenting and naming.

Sniffed and tested.