Added buildUpdate and buildMerge function