A complete rewrite.