Add minDist and transIndices function