Rewrote basically everything