Refactored parser a little