Rewrite (single thread)