added distance formula