#262, use window instead of this, allows Browserifyication