added distance formula js snippet