small refactorings to parser code