sliding window code up