commented on code to make easier to understand.