code before made change to how gm calculated for theta b