Added some comments to explain code more