Refactor factor rule
Fix term rule