working calculate distance.js