added comments to code, more info to output headers