atomic rewrite