Added some more support for grid search