Refactor base classes