fixed bug in distance formula, thats right, the distance formula