Gates agrees to plea bargain terms.