injected $window a few places, after un-refactoring