Added var keyword to self variable to avoid namespace collisions