Some cleanup and refactoring of role_id update.