Added comments, added for loop instead of duplicate code.