Rewrote the whole thing