optimizing record distances