Update for Parser

I made the parser way more concise and get rid of the ton of switches. Added a test to check that my version gives the same result as the old one does.