added window functions, working on external windows