Changed method of referencing 'window'