thread-first rewrite