Added in additional comments explainin the code.