added test
first pass refactor
passing tests