split out the parser to make it more understandable