Refactor before dirty-rules feature