Added comments to explain code