cleaned up some comments, rearranges some methods