massive rework to do Icode correctly