Refactored tenplate in the spirit of DRY