Refactor solution with test