Wrote most of the parsing code for generator