Migrated code from old api