added distance calculating to friends and sorting