Added some comments to make it easier to understand