changes window to $window