Bunch of additions and fixes