refactored common code into Base