Solved Problem 5
Refactored problem11 to DRY up my code