replaced var to use self = this