diff --git a/TestON/bin/cli.py b/TestON/bin/cli.py
index 54d9781..ffe9d67 100755
--- a/TestON/bin/cli.py
+++ b/TestON/bin/cli.py
@@ -93,23 +93,15 @@
         mail <mail-id or list of mail-ids seperated by comma>
         example 1, to execute the examples specified in the ~/examples diretory.
         '''
-        try:
-            args = args.split()
-            options = {}
-            options = self.parseArgs(args,options)
-            options = dictToObj(options)
-            if not testthread:
-                test = TestThread(options)
-                test.start()
-                while test.isAlive:
-                    test.join(1)
-            else :
-                print main.TEST+ " test execution paused, please resume that before executing to another test"
-        except KeyboardInterrupt, SystemExit:
-            print "Interrupt called, Exiting."
-            test._Thread__stop()
-            main.cleanup()
-            main.exit()
+        args = args.split()
+        options = {}
+        options = self.parseArgs(args,options)
+        options = dictToObj(options)
+        if not testthread:
+            test = TestThread(options)
+            test.start()
+        else :
+            print main.TEST+ " test execution paused, please resume that before executing to another test"
 
     def do_resume(self, line):
         '''
@@ -165,7 +157,7 @@
             else :
                 try :
                     dump.pprint(vars(main)[line])
-                except KeyError as e:
+                except KeyError,e:
                     print e
         else :
             print "There is no paused test "
@@ -269,7 +261,7 @@
                         options = self.testcasesInRange(index,option,args,options)
                 else :
                     options['testname'] = option
-        except IndexError as e:
+        except IndexError,e:
             print e
 
         return options
@@ -318,11 +310,7 @@
                 super(CLI, self).cmdloop(intro="")
                 self.postloop()
             except KeyboardInterrupt:
-                if testthread:
-                    testthread.pause()
-                else:
-                    print "KeyboardInterrupt, Exiting."
-                    sys.exit()
+                testthread.pause()
 
     def do_echo( self, line ):
         '''
@@ -349,7 +337,7 @@
         '''
         try:
             exec( line )
-        except Exception as e:
+        except Exception, e:
             output( str( e ) + '\n' )
 
     def do_interpret(self,line):
@@ -365,7 +353,7 @@
         try :
             translated_code = ospk.interpret(text=line)
             print translated_code
-        except AttributeError as e:
+        except AttributeError, e:
             print 'Dynamic params are not allowed in single statement translations'
 
     def do_do (self,line):
@@ -379,9 +367,8 @@
             try :
                 translated_code = ospk.interpret(text=line)
                 eval(translated_code)
-            except ( AttributeError, SyntaxError ) as e:
-                print 'Dynamic params are not allowed in single statement translations:'
-                print e
+            except (AttributeError,SyntaxError), e:
+                print 'Dynamic params are not allowed in single statement translations'
         else :
             print "Do will translate and execute the openspeak statement for the paused test.\nPlease use interpret to translate the OpenSpeak statement."
 
@@ -544,8 +531,8 @@
                         if not self.is_stop :
                             result = self.test_on.cleanup()
                         self.is_stop = True
-                except KeyboardInterrupt:
-                    print "Recevied Interrupt, cleaning-up the logs and drivers before exiting"
+                except(KeyboardInterrupt):
+                    print "Recevied Interrupt,cleaning-up the logs and drivers before exiting"
                     result = self.test_on.cleanup()
                     self.is_stop = True
 
@@ -555,17 +542,9 @@
         '''
         Will pause the test.
         '''
-        if not cli.pause:
-            print "Will pause the test's execution, after completion of this step.....\n\n\n\n"
-            cli.pause = True
-            self._stopevent.set()
-        elif cli.pause and self.is_stop:
-            print "KeyboardInterrupt, Exiting."
-            self.test_on.exit()
-        else:
-            print "Recevied Interrupt, cleaning-up the logs and drivers before exiting"
-            result = self.test_on.cleanup()
-            self.is_stop = True
+        print "Will pause the test's execution, after completion of this step.....\n\n\n\n"
+        cli.pause = True
+        self._stopevent.set()
 
     def play(self):
         '''
