Could this code go in the switch statement above? I think it would be a little cleaner if so.