replaced window with $window service