pass environment to pivot functions