Added more notes to make the code easier to follow along with.