improved template inheritance