Added some documentation/comments for over half of the code.