modified python script so that if -r is called, the program is run in a separate tab