sliding window is now working up until the final window. works
perfectly with window size 1, and sometimes works with larger windows,
sometimes doesn't.