Penal Code section 654 applies to calculation of the maximum period of confinement of a defendant found insane at the time of the offense. Appellant was convicted of carjacking and assault with a deadly weapon (ADW). The jury found he was insane at the time of the offenses. He challenged the trial court’s refusal to apply section 654 to the confinement term pronounced for the ADW. Held: Commitment term reduced. Section 654 applies in calculating the maximum term of confinement of a defendant found guilty but insane at the time of the offenses. Here, the ADW was committed to facilitate the carjacking. The “course of conduct was indivisible” and the two offenses virtually simultaneous. Temporal proximity is a relevant consideration in determining whether the defendant’s conduct is divisible. Still, section 654 may not apply if the defendant entertains multiple intents and objectives. That was not the case here, as defendant’s use of a hammer against a resisting carjacking victim was incidental to the taking of the vehicle.