Set arity on all functions

Use the function arity feature to remove a lot of boilerplate code from
the functions.