Nearly a whole rewrite