refactoring, so variables are used in class scope