Refined search instead of brute force.