Refactored template inheritance