Criminal procedure concerns the rules regarding the treatment of criminal defendants during the time from their arrest until the determination of a final verdict. From an economic perspective, the goal of this process is to achieve the most accurate determination of guilt at the lowest possible cost. The process encompasses plea bargaining, the bail system, rules regarding the determination of guilt at trial, and appeal. Criminal procedure also affects deterrence because it ultimately determines the expected punishment imposed on offenders. However, uncertainty in enforcement necessarily leads to a conflict between the goals of deterrence and error avoidance.