Changed global var to window member