Did lots and lots of cleanup for compat with older GCCs. Still not quite compiling on GCC though, and it's segfaulting MSVC completely. I think Microsoft need to make a new compiler :(