Significant rewrite to align with DistanceDecay project