Refactor problem #3