Tried to fix something, moving global variables to the class