Gazillion of fixes and cleanups