DRY up code: part 1