Change variable scopes

Some variables were defined as class-level properties, when they were
only used in one method, so I made them local to the method.