calculations done with more efficient code