added test
refactored