Added as many comments as I could.