Rewrote some stuff