Extract common functionality into an base class