[r] Refactor exam groups and related models