Massive internal rewrite