swift refactoring