Loads more fixes and cleanups