changed window swapping implementation