better grid search