diff --git a/src/yokadi/taskcmd.py b/src/yokadi/taskcmd.py
index 78980d8..47eeab4 100644
--- a/src/yokadi/taskcmd.py
+++ b/src/yokadi/taskcmd.py
@@ -46,56 +46,62 @@ class TaskCmd(object):
         for name in bugutils.PROPERTY_NAMES:
             dbutils.getOrCreateKeyword(name, interactive=False)
 
-    def do_bug_add(self, line):
-        """Add a bug-type task. Will create a task and ask additional info.
-        bug_add <project_name> [@<keyword1>] [@<keyword2>] <Bug description>
-        """
+    def _t_add(self, cmd, line):
+        """Code shared by t_add and bug_add."""
+        line = line.strip()
+        if not line:
+            tui.error("Missing parameters")
+            self.do_help(cmd)
+            return None
         projectName, title, keywordDict = parseutils.parseLine(line)
         if not title:
-            raise YokadiException("You should give a bug title")
+            tui.error("Missing title")
+            self.do_help(cmd)
+            return None
         task = dbutils.addTask(projectName, title, keywordDict)
         if not task:
-            tui.reinjectInRawInput(u"bug_add " + line)
+            tui.reinjectInRawInput(u"%s %s" % (cmd, line))
+            return None
+        self.lastTaskId = task.id
+        return task
+
+    def do_t_add(self, line):
+        """Add new task. Will prompt to create keywords if they do not exist.
+        t_add <projectName> [@<keyword1>] [@<keyword2>] <title>"""
+        task = self._t_add("t_add", line)
+        if task:
+            print "Added task '%s' (id=%d)" % (task.title, task.id)
+    complete_t_add = projectAndKeywordCompleter
+
+    def do_bug_add(self, line):
+        """Add a bug-type task. Will create a task and ask additional info.
+        bug_add <project_name> [@<keyword1>] [@<keyword2>] <title>
+        """
+        task = self._t_add("bug_add", line)
+        if not task:
             return
 
+        keywordDict = task.getKeywordDict()
         bugutils.editBugKeywords(keywordDict)
         task.setKeywordDict(keywordDict)
-
         task.urgency = bugutils.computeUrgency(keywordDict)
-        self.lastTaskId = task.id
 
-        print "Added bug '%s' (id=%d, urgency=%d)" % (title, task.id, task.urgency)
+        print "Added bug '%s' (id=%d, urgency=%d)" % (task.title, task.id, task.urgency)
 
     complete_bug_add = ProjectCompleter(1)
 
     def do_bug_edit(self, line):
         """Edit a bug.
         bug_edit <id>"""
-        task = self.getTaskFromId(line)
-
-        # Create task line
-        taskLine = parseutils.createLine("", task.title, task.getKeywordDict())
+        task = self._t_edit(line)
+        if not task:
+            return
 
-        # Edit
-        while True:
-            print "(Press Ctrl+C to cancel)"
-            try:
-                line = tui.editLine(taskLine)
-                if not line.strip():
-                    tui.warning("Indicate a bug title !")
-                    continue
-            except KeyboardInterrupt:
-                print
-                print "Cancelled"
-                return
-            foo, title, keywordDict = parseutils.parseLine(task.project.name + " " + line)
-            if dbutils.updateTask(task, task.project.name, title, keywordDict):
-                break
+        keywordDict = task.getKeywordDict()
         bugutils.editBugKeywords(keywordDict)
         task.setKeywordDict(keywordDict)
-
-        # Update bug
         task.urgency = bugutils.computeUrgency(keywordDict)
+    complete_bug_edit = taskIdCompleter
 
     def getTaskFromId(self, line):
         line = line.strip()
@@ -108,22 +114,6 @@ class TaskCmd(object):
             self.lastTaskId = task.id
         return task
 
-    def do_t_add(self, line):
-        """Add new task. Will prompt to create keywords if they do not exist.
-        t_add <projectName> [@<keyword1>] [@<keyword2>] <Task description>"""
-        projectName, title, keywordDict = parseutils.parseLine(line)
-        if not title:
-            raise YokadiException("You should give a task title")
-        task = dbutils.addTask(projectName, title, keywordDict)
-        if task:
-            print "Added task '%s' (id=%d)" % (title, task.id)
-        else:
-            tui.reinjectInRawInput(u"t_add " + line)
-        if task:
-            self.lastTaskId = task.id
-
-    complete_t_add = projectAndKeywordCompleter
-
     def do_t_describe(self, line):
         """Starts an editor to enter a longer description of a task.
         t_describe <id>"""
@@ -539,10 +529,8 @@ class TaskCmd(object):
 
     complete_t_show = taskIdCompleter
 
-    def do_t_edit(self, line):
-        """Edit a task.
-        t_edit <id>"""
-
+    def _t_edit(self, line):
+        """Code shared by t_edit and bug_edit."""
         def editComplete(text, state):
             """ Specific completer for the edit prompt.
             This subfunction should stay here because it needs to access to cmd members"""
@@ -566,8 +554,8 @@ class TaskCmd(object):
         # Create task line
         taskLine = parseutils.createLine("", task.title, task.getKeywordDict())
 
-        old_completer = readline.get_completer() # Backup previous completer to restore it in the end
-        readline.set_completer(editComplete)     # Switch to specific completer
+        oldCompleter = readline.get_completer() # Backup previous completer to restore it in the end
+        readline.set_completer(editComplete)    # Switch to specific completer
 
         while True:
             # Edit
@@ -575,19 +563,24 @@ class TaskCmd(object):
             try:
                 line = tui.editLine(taskLine)
                 if not line.strip():
-                    tui.warning("Indicate a task title !")
+                    tui.warning("Missing title")
                     continue
             except KeyboardInterrupt:
                 print
                 print "Cancelled"
-                readline.set_completer(old_completer)   # Restore standard completer
-                return
+                task = None
+                break
             foo, title, keywordDict = parseutils.parseLine(task.project.name + " " + line)
             if dbutils.updateTask(task, task.project.name, title, keywordDict):
                 break
 
-        readline.set_completer(old_completer)   # Restore standard completer
+        readline.set_completer(oldCompleter)   # Restore standard completer
+        return task
 
+    def do_t_edit(self, line):
+        """Edit a task.
+        t_edit <id>"""
+        self._t_edit(line)
     complete_t_edit = taskIdCompleter
 
     def do_t_set_project(self, line):

