update the gridsearch function