Refactor rules