Safer path bindings

Instead of putting the unsafety burden on the user of path finding, let them just pass in a closure and do the low-level stuff ourselves.