added documentation/comments to code