full grid search coded