A set of four simple cleanups of the IB code follows, for the most case the cleanups are intended for improving the clarity/correctness of the code, where on the forth patch there is also some resource saving. Or.