Template logic simplification without Demian's typo