Add windowing function