added comments to improve quality of code