Refactoring, use local variables instead of instance variables