If you move this here, can you remove the binarySearch() function from the gallery?  I think we use it there also.