Added more documentation and refactored some method names.