Refactored parsing