Modified to use the Template Method Pattern