seperate calculate distance