[MIG]CRM: Migrated CRM into new API.

[IMP] improve code