Implementing feature #18. Added comments to code