Extensive rewrite