Added some comments to improve readability