I guess the other option would be to move the switch statement inside, but that looks a bit ugly and not quite as efficient.