Added additional comments to make code more readable.