A lot of major fixes