Added ability to use a custom function for filtering select options