Major cleanup of comments and rearranging of some methods.