Refactored the parse routine into multiple clean methods