redo logic