You should refer to the `window` object as `g` here (see line 824).