Major restructuring, rewrite