DRY up the codebase a bit

Signed-off-by: Stephen Gran <steve@lobefin.net>