use window instead of this so that we can browserify this module