Refactor rule visitors