remove the $window dependency