Bunch of fixes + cosmetic changes