moved intex->temp to allow testing