LOTS and lots of fixes