added more comments to the code whn reviewing