refactor solution