Fixed minor parsing code errors.
Added comments to the code.