Cleaned up grid search a bit