create a searching loop