Cleaned up some code and some problems with syntax error generation. There are still memory corruption bugs being reported by valgrind.