modify function name and add default to switch block.