search algorithm complete and functioning