Another massive rewrite