Make distance() accept arguments of different types