added documentation and refactored some method names