Refactored rule creation.