cleaned up the parser code