Modified W-mem into sliding window.