manual merge Chris' work on the distance calculater