Optimize rolling back and window moving.