Started adding comments to the code for readability