diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..45fc1eb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+*.mo
+*.pyc
+*.xo
+*~
+.*.sw?
+locale/
+MANIFEST
+dist/
diff --git a/NEWS b/NEWS
index 8230151..9290128 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,17 @@
+47
+
+* Add missing NEWS (James Cameron),
+* Rename and update README (James Cameron),
+* Port to Python 3 (Rahul Bothra),
+* Fix help button no response to click (James Cameron),
+
+46
+
+* Add button to clear history (Hrishi Patel),
+* Clean environment of activity variables (James Cameron),
+* New translations pt_BR (Paulo Franscisco),
+* Update POT file (James Cameron),
+
 45.4
 
 * Update translations,
diff --git a/README b/README.md
similarity index 69%
rename from README
rename to README.md
index d7533db..e5dbfb6 100644
--- a/README
+++ b/README.md
@@ -1,7 +1,7 @@
 What is this?
 =============
 
-Terminal is a full-screen text mode program that provides a Command-Line Interface (CLI) to the software on a Linux system, such as the Fedora Linux that Sugar on the XO is based on.
+Terminal is a full-screen text mode program that provides a Command-Line Interface (CLI) to the software on a Linux system.
 
 How to use?
 ===========
@@ -10,4 +10,4 @@ Terminal is part of the Sugar desktop.  Please refer to;
 
 * [How to Get Sugar on sugarlabs.org](https://sugarlabs.org/),
 * [How to use Sugar](https://help.sugarlabs.org/),
-* [How to use Terminal](https://help.sugarlabs.org/terminal.html)
+* [How to use Terminal](https://help.sugarlabs.org/terminal.html) ([or source](https://github.com/sugarlabs/help-activity/blob/master/source/terminal.rst)).
diff --git a/activity/activity.info b/activity/activity.info
index 46414f1..2c7b754 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -1,12 +1,12 @@
 [Activity]
 name = Terminal
-activity_version = 45.4
+activity_version = 47
 bundle_id = org.laptop.Terminal
-exec = sugar-activity terminal.TerminalActivity
+exec = sugar-activity3 terminal.TerminalActivity
 icon = activity-terminal
 mime_types =
 license = GPLv2+;GPLv3+
-summary = Here you have complete control over your computer. You are in charge!! 
+summary = Here you have complete control over your computer. You are in charge!!
 repository = https://github.com/sugarlabs/terminal-activity.git
-tags = Utilities;System 
+tags = Utilities;System
 url = https://help.sugarlabs.org/en/terminal.html
diff --git a/debian/changelog b/debian/changelog
index 52bb083..ef2b2db 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sugar-terminal-activity (47-1) UNRELEASED; urgency=medium
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Thu, 17 Oct 2019 03:17:10 +0000
+
 sugar-terminal-activity (45.4-1) unstable; urgency=medium
 
   [ upstream ]
diff --git a/helpbutton.py b/helpbutton.py
index 913340f..648b2a4 100644
--- a/helpbutton.py
+++ b/helpbutton.py
@@ -65,7 +65,7 @@ class HelpButton(Gtk.ToolItem):
         help_button.connect('clicked', self.__help_button_clicked_cb)
 
     def __help_button_clicked_cb(self, button):
-        self._palette.popup(immediate=True, state=1)
+        self._palette.popup(immediate=True)
 
     def add_section(self, section_text):
         hbox = Gtk.Box()
diff --git a/po/Terminal.pot b/po/Terminal.pot
index 8b0011b..14226c1 100644
--- a/po/Terminal.pot
+++ b/po/Terminal.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2018-08-13 17:43+1000\n"
+"POT-Creation-Date: 2019-09-09 10:57+1000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -29,101 +29,105 @@ msgstr ""
 msgid "Help"
 msgstr ""
 
-#: terminal.py:221
+#: terminal.py:174
+msgid "Clear scrollback"
+msgstr ""
+
+#: terminal.py:224
 msgid "Zoom out"
 msgstr ""
 
-#: terminal.py:228
+#: terminal.py:231
 msgid "Zoom in"
 msgstr ""
 
-#: terminal.py:235
+#: terminal.py:238
 msgid "Fullscreen"
 msgstr ""
 
-#: terminal.py:261
+#: terminal.py:264
 msgid "Useful commands"
 msgstr ""
 
-#: terminal.py:262
+#: terminal.py:265
 msgid "cd"
 msgstr ""
 
-#: terminal.py:263
+#: terminal.py:266
 msgid "Change directory"
 msgstr ""
 
-#: terminal.py:264
+#: terminal.py:267
 msgid "To use it, write: cd directory"
 msgstr ""
 
-#: terminal.py:266
+#: terminal.py:269
 msgid ""
 "If you call it without parameters, will change\n"
 "to the user directory"
 msgstr ""
 
-#: terminal.py:268
+#: terminal.py:271
 msgid "ls"
 msgstr ""
 
-#: terminal.py:269
+#: terminal.py:272
 msgid "List the content of a directory."
 msgstr ""
 
-#: terminal.py:270
+#: terminal.py:273
 msgid "To use it, write: ls directory"
 msgstr ""
 
-#: terminal.py:272
+#: terminal.py:275
 msgid ""
 "If you call it without parameters, will list the\n"
 "working directory"
 msgstr ""
 
-#: terminal.py:274
+#: terminal.py:277
 msgid "cp"
 msgstr ""
 
-#: terminal.py:275
+#: terminal.py:278
 msgid "Copy a file to a specific location"
 msgstr ""
 
-#: terminal.py:276
+#: terminal.py:279
 msgid "Call it with the file and the new location"
 msgstr ""
 
-#: terminal.py:277
+#: terminal.py:280
 msgid "Use: cp file directory"
 msgstr ""
 
-#: terminal.py:278
+#: terminal.py:281
 msgid "rm"
 msgstr ""
 
-#: terminal.py:279
+#: terminal.py:282
 msgid "Removes a file in any path"
 msgstr ""
 
-#: terminal.py:280
+#: terminal.py:283
 msgid "Use: rm file"
 msgstr ""
 
-#: terminal.py:281
+#: terminal.py:284
 msgid "su"
 msgstr ""
 
-#: terminal.py:282
+#: terminal.py:285
 msgid "Login as superuser (root)"
 msgstr ""
 
-#: terminal.py:284
+#: terminal.py:287
 msgid ""
 "The root user is the administrator of the\n"
 "system"
 msgstr ""
 
-#: terminal.py:286
+#: terminal.py:289
 msgid ""
 "You must be careful, because you can modify\n"
 "system files"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index b0317fa..3289697 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -7,7 +7,7 @@ msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-03-24 17:39+1100\n"
-"PO-Revision-Date: 2018-09-03 18:44+0000\n"
+"PO-Revision-Date: 2019-03-09 01:33+0000\n"
 "Last-Translator: Paulo Francisco <slomp@ufrgs.br>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "Language: pt_BR\n"
@@ -16,7 +16,7 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
 "X-Generator: Pootle 2.5.1.1\n"
-"X-POOTLE-MTIME: 1536000264.000000\n"
+"X-POOTLE-MTIME: 1552095190.000000\n"
 
 #: activity/activity.info:2
 msgid "Terminal"
@@ -57,7 +57,7 @@ msgstr "Mudar diretório"
 
 #: terminal.py:231
 msgid "To use it, write: cd directory"
-msgstr "Para usar, escreva: cd \"nome_do_diretorio\""
+msgstr "Para usar, escreva: cd nome_do_diretório"
 
 #: terminal.py:233
 msgid ""
@@ -77,7 +77,7 @@ msgstr "Lista o conteúdo de um diretório."
 
 #: terminal.py:237
 msgid "To use it, write: ls directory"
-msgstr "Para usar ele, escreva: ls \"nome do diretório\""
+msgstr "Para usar ele, escreva: ls nome do diretório"
 
 #: terminal.py:239
 msgid ""
diff --git a/terminal.py b/terminal.py
index 30570e9..f109061 100644
--- a/terminal.py
+++ b/terminal.py
@@ -19,14 +19,14 @@
 import os
 import sys
 import json
-import ConfigParser
+import configparser
 import logging
 from gettext import gettext as _
 
 import gi
 
 vs = {'Gtk': '3.0', 'SugarExt': '1.0', 'SugarGestures': '1.0'}
-for api, ver in vs.iteritems():
+for api, ver in vs.items():
     gi.require_version(api, ver)
 
 try:
@@ -65,7 +65,7 @@ log.setLevel(logging.DEBUG)
 logging.basicConfig()
 
 try:
-    olpc_build = file('/boot/olpc_build', 'r').readline()
+    olpc_build = open('/boot/olpc_build', 'r').readline()
 except:
     olpc_build = ''
 
@@ -169,6 +169,13 @@ class TerminalActivity(activity.Activity):
         edit_toolbar.copy.props.accelerator = '<Ctrl><Shift>C'
         edit_toolbar.paste.connect('clicked', self.__paste_cb)
         edit_toolbar.paste.props.accelerator = '<Ctrl><Shift>V'
+
+        clear = ToolButton('edit-clear')
+        clear.set_tooltip(_('Clear scrollback'))
+        clear.connect('clicked', self.__clear_cb)
+        edit_toolbar.insert(clear, -1)
+        clear.show()
+
         return edit_toolbar
 
     def __copy_cb(self, button):
@@ -415,20 +422,34 @@ class TerminalActivity(activity.Activity):
 
             # Restore the scrollback buffer.
             for l in tab_state['scrollback']:
-                vt.feed(str(l) + '\r\n')
+                vt.feed(l.encode('utf-8') + b'\r\n')
+
+        argv = [os.environ.get('SHELL') or '/bin/bash']
+        envv = ['SUGAR_TERMINAL_VERSION=%s' %
+                    os.environ['SUGAR_BUNDLE_VERSION']]
+
+        saved = {}
+        for name in ['SUGAR_BUNDLE_PATH', 'SUGAR_ACTIVITY_ROOT',
+                         'SUGAR_BUNDLE_ID', 'SUGAR_BUNDLE_NAME',
+                         'SUGAR_BUNDLE_VERSION']:
+            if name in os.environ:
+                saved[name] = os.environ[name]
+                del os.environ[name]
 
-        shell_cmd = os.environ.get('SHELL') or '/bin/bash'
         if hasattr(vt, 'fork_command_full'):
-            sucess_, box.pid = vt.fork_command_full(
+            _, box.pid = vt.fork_command_full(
                 Vte.PtyFlags.DEFAULT, os.environ["HOME"],
-                [shell_cmd], [], GLib.SpawnFlags. DO_NOT_REAP_CHILD,
+                argv, envv, GLib.SpawnFlags.DO_NOT_REAP_CHILD,
                 None, None)
         else:
-            sucess_, box.pid = vt.spawn_sync(
+            _, box.pid = vt.spawn_sync(
                 Vte.PtyFlags.DEFAULT, os.environ["HOME"],
-                [shell_cmd], [], GLib.SpawnFlags. DO_NOT_REAP_CHILD,
+                argv, envv, GLib.SpawnFlags.DO_NOT_REAP_CHILD,
                 None, None)
 
+        for name in saved:
+            os.environ[name] = saved[name]
+
         self._notebook.props.page = index
         vt.grab_focus()
 
@@ -572,12 +593,12 @@ class TerminalActivity(activity.Activity):
             else:
                 return conf.get('terminal', var)
         else:
-            conf.set('terminal', var, default)
+            conf.set('terminal', var, str(default))
 
             return default
 
     def _configure_vt(self, vt):
-        conf = ConfigParser.ConfigParser()
+        conf = configparser.ConfigParser()
         conf_file = os.path.join(env.get_profile_path(), 'terminalrc')
 
         if os.path.isfile(conf_file):
@@ -642,3 +663,9 @@ class TerminalActivity(activity.Activity):
             vt.set_visible_bell(visible_bell)
 
         conf.write(open(conf_file, 'w'))
+
+    def __clear_cb(self, button):
+        vt = self._notebook.get_nth_page(self._notebook.get_current_page()).vt
+        n = vt.get_scrollback_lines()
+        vt.set_scrollback_lines(0)
+        vt.set_scrollback_lines(n)