using dist if possible