implemented q_value