Rewrite and simplify