Migrated recording code to a fragment