Wrote distance Class