refactoring of parser