added windowing function to reverse buffer