Forgot breaks and defaults in the case statements, added.