Fixed some things. Added clientside distance calculation for testing.