Modify handleCommand.