DRY up some repititive code