Trying to reduce boilerplate code