Improve optimization logic so that it picks up more different values/tuples.