allow passing a function for maximumSelectionSize