Practically a complete rewrite.