extracted common code in SymbolicRewriter