Loads of fixes & cleanups