Adding wrappers for location and distance, part 1.
Adding wrappers for location and distance, part 2.
Adding wrappers for location and distance, part 3.
Make sure AMs are dropped when routing fails.
Minor cleanups.