Code cleanliness

Added some more comments, rearranged some methods and such.