refactor. Allow more overrides in templates