Minor refactoring
Use default template when given invalid template