Started refactoring parser