Buggy sliding window implementation