added grid search to look for the best parameters