Simplified inheritance of templates and removed old code