Add multi-arity support to templates