added some more parser comments to explain logic