pps: declare variables where they are used in switch