The variable "console" is picked up from the global scope? That's going to be impossible to debug later. Please make this more explicit.