in reply to switch statement
Use a dispatch table.
There is plenty amount of documentation on how using Switch breaks your program in surprising ways on this site.