Function mergeIf