cleanup and simplification for parser