Refactoring to permit all-versus-all classification.