Refactored some good to make the code more legible. Followed the guidelines of Tealeaf's TAs.