Remove the recursion on rewriting while enhancing the strategies for more exprecivity.