Refactor problem 11