Merging redo function