Moved rule refactor out