modify some code for switch todo mode to edit