Added comments to make code more readable