Implementation of new parser

A lot easier to follow the logic, a lot less persistent state