reduce use of window specific code in the context implementation code