Refactored window to $window