added cpi function