Use an embedded switch statement to execute steps

Uses a switch structure to directly execute steps when a condition is met, without jumping to other steps.