Some fixes + improvements