Added functions to swap buffers between windows