I've added a few protected methods that allow a subclass to override certain behaviour.