DRYing up text prefix code