Copy bugfixed version of erlehmann's redo script.