master adding the merge and switch functions