extract some protect method so that subclasses can use them.