optimize search grid