The primary purpose of a criminal trial is to ensure fairness in determining the guilt or innocence of a criminal defendant. The entire process is governed by rules that have evolved from common law, the Canadian Criminal Code, legal precedents from other criminal cases, the Charter of Rights, and provincial law. This collection of laws and procedures covers all of the components of a criminal trial—police surveillance and investigations, interrogations, searches, how evidence is gathered, the arrest, and all of the preliminary judicial aspects of bringing a case to trial. The vast majority of criminal prosecutions end with a plea bargain, where the defendant admits to a lesser charge in exchange for forgoing the right to a trial. However, no one should accept a plea without a thorough examination of the evidence and the methods used to acquire that evidence.