loads of changes i need to test and fix - haven't tried compiling the new stuff yet :)