Refactor Problem 25