clean up code in parser