Holy crap, this was alot of work