full rewrite