parser reworked, doesn't crash

hopefully gives the correct output, still need to verify