Added a whole bunch of crap to make it work on Windows