Clean up
WOrking logic for rule exit.