Refactor problem 2 in Swift for better legibility