Thats' the way to do it Tom.
I learned the lesson when having to return in their original packaging, some first generation 3 rail #5 double slip switches for modification. To get the switch back in the Styrofoam it was necessary to flex the Styrofoam to let the switch slip back in.
Flexing the Styrofoam removes the need to fight the switch to get it out.