Fixed everything up, rewrote the parser, added some tests