distance calculations

pushing largely so I can extract my new code as notebook is broken!
Revert "distance calculations"

This reverts commit e2ec78e662653c880f4ae7622afddcd7b6ad228e.
distance calculations 2

Added distance calculations in a way that doesn't break everything.