Redo algorithm