added comments to code to make it clearer