improve template by using template inheritance