Cleaned up parser and added some comments