Make all these "bodies" to the 'switch' statement into their own functions.  That way, your 'switch' statement stays very short and readers can see exactly what the logic of it is, at a single glance.  Move the functions down below, as they then represent bundled, forgettable detail.