Refactoring of parser