parsing refactor