Bunch of fixes and small changes