Reduce scope of class variables, remove unused code.
Patch by Nishanth Rodriquez, thanks!
Phabricator diff D1775