distance implemented