Changed how vars are added to the global context
- using this keywork for the global context instead of window allows the
  code to work in js environments without a dom as well as in browsers