windowing algo partial implementation