Make sure to rewrite WITH as well as RETURN clauses