move all parsing code to the parser