Abstracting boilerplate code