SortAlgorithm refactoring more functional style