refactor problem three