Added loops for calculation of jacobians