changed a_w to P_w