Complete rewrite.