Implemented all functionality described by tests. Refactored.