slight simplification in itm
ENH some cleanup of the algorithm.