Templates refactored to use inheritance