Added comments to code for a better description of whats going on in the code