cleanup
moved libraries around; added didtance calucaltion