Converting sliding window to has