refactored
tests added