moved parser code into functions, gutted old unit tests which were no longer valid