cleanup, major fixes