Add code for brute force grid search method