simplification of functions calculate()