DRYing COF code a bit