Rewrite most of it