add MergeTables function