Add multi-arity support to templates

Bit of a bulky implementation, but it works. Forgot about adding tests sorry, will do in a second commit. Also, should snippets have multi-arities too? They don't seem as necessary (API consistency surely would be increased though).