Added the notes to each line to make it more clear what is going on within the code.