added comments to most of the parser code