Convert code to roles/profiles pattern