Added comments to code for readability for others