Added comments to explain code purpose