refactored common code into base clases