Separate path finding into a function (will be used in hcst too)

2 jobs for dev-decadal-user_feedback
in 3 minutes and 36 seconds, using 0 compute credits, and was queued for 3 seconds