He asked how to optimize the code he posted. Not to assume the rest of the code and optimize that. For all we know, he is already using a switch on cclass.
I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).