sped up performance by only calling configure overlay once in the base case