iimplementing distance