Main ITML algorithm implemented.