Make sure that points have cordinates

    Defensive programming
Fix the query sued to get team distances
Split out auth generating into separate function
Add code for JawBone