Refactored templates to use inheritance