significantly sped up the unary function case.