re-arranged parse method to more readable methods