Change to use Layered distance function.  Allow user selection.