add window refreshing support

harsh one, not complete, but works.