Initial refactoring to move some common functionality into a parent class.