Changes name of global app variable to chatApp in order to prevent unwanted matching when doing this.app from the window context
Binds 'this' context to some callbacks in order not to have to pass it