Refactor Problem 4
Refactor Problem 5