Refactoring in parser