refactored and added documentation
removed test