Rewrote most of it :)