updated backtrack-fn so that it takes all bactrack params through closure