Changed distance formula to something that actually worked