First crack at search algorithm