adding script to calculate the calculated fields