refactoring solution for Mac