Refactor TERM rule