Fixed undef parsing and added a test
Also cleaned up some of the syntax