Refactored reader into separate lex/parse steps