DRYing up layout selection