Bunch of changes and fixes