This is a scoping error and the definition of mergePolicy should be hoisted out to line 1983