Refactor test_grid and benchmark.rb to make several iterations