Refactored common setup into a superclass to lessen code duplication.