Unified template code