simplify
refactor for testability, increase coverage to 96%