Small fixes

added some small fixes and comments to code.