Parser overhaul, bugfixes

Should be a fully working parser, documentation to come