Near full rewrite.