Cut boilderplate

I didn't even try to type check this, but here's a suggestion of how to reduce some boilerplate.