improves lookup to calculates the closest distance from the given hash key