Work on breaking out more of the parsing logic into subroutines, cleanup,
assertions and comments.
Increased unit test converage, particularly of parsing substitutions.