Code cleaned up

Methods extracted for readability.  63 tests passing.