CRM-15341 - move cms-specific code to appropriate file