streamlined code by only retrieving existing documents once, instead of for every design doc