Refactoring the maxNumberOfFilesShown