Rewrite findprovisionrange to use factorized functions