refactored parser, way much better now