replaced more explicit calculations of yw with gamma_w function