This may solve your problem, or it may do nothing, but it is HIGHLY advised to put break statements at the end of each case in a switch statement. For example, I took a bit of your code and edited it...