Remove variables, switch to inherits.

This commit removes all the local copies of variables in the subclasses
and simply inherits the main class in order to bring variables into the
right scope.