Completed MergeVars implementation