tests passing
refactored