diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RContextMR.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RContextMR.java
new file mode 100644
index 0000000000000000000000000000000000000000..19ed14c1253f992a27cb3bff458f80a54ece9229
--- /dev/null
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RContextMR.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2017, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.truffle.r.engine.interop;
+
+import com.oracle.truffle.api.interop.CanResolve;
+import com.oracle.truffle.api.interop.MessageResolution;
+import com.oracle.truffle.api.interop.TruffleObject;
+import com.oracle.truffle.api.nodes.Node;
+import com.oracle.truffle.r.engine.TruffleRLanguage;
+import com.oracle.truffle.r.runtime.context.RContext;
+
+@MessageResolution(receiverType = RContext.class, language = TruffleRLanguage.class)
+public class RContextMR {
+    @CanResolve
+    public abstract static class RContext extends Node {
+
+        protected static boolean test(TruffleObject receiver) {
+            return receiver instanceof RContext;
+        }
+    }
+
+}
diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java
index d9f4321f1ae23b6ef3a88df827a69aa497b26287..9082fefc169f2c968b3d4eb6e6b27411e2ed162c 100644
--- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java
@@ -29,6 +29,7 @@ import com.oracle.truffle.api.interop.MessageResolution;
 import com.oracle.truffle.r.engine.TruffleRLanguage;
 import com.oracle.truffle.r.engine.interop.ffi.nfi.TruffleNFI_Base;
 import com.oracle.truffle.r.engine.interop.ffi.nfi.TruffleNFI_PCRE;
+import com.oracle.truffle.r.engine.interop.ffi.nfi.TruffleNFI_UpCallsRFFIImpl;
 import com.oracle.truffle.r.runtime.RInternalError;
 import com.oracle.truffle.r.runtime.conn.RConnection;
 import com.oracle.truffle.r.runtime.context.RContext;
@@ -102,6 +103,8 @@ public final class RForeignAccessFactoryImpl implements RForeignAccessFactory {
             return CharSXPWrapperMRForeign.ACCESS;
         } else if (obj instanceof RConnection) {
             return RConnectionMRForeign.ACCESS;
+        } else if (obj instanceof RContext) {
+            return RContextMRForeign.ACCESS;
         } else if (obj instanceof TruffleNFI_Base.TruffleNFI_UnameNode.UnameUpCallImpl) {
             return UnameUpCallImplMRForeign.ACCESS;
         } else if (obj instanceof TruffleNFI_Base.TruffleNFI_ReadlinkNode.SetResultImpl) {
diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/RMain.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/RMain.java
new file mode 100644
index 0000000000000000000000000000000000000000..4a65dc84dbbce67cdc35a1cfb883e4dcd9a32547
--- /dev/null
+++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/shell/RMain.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.truffle.r.engine.shell;
+
+/**
+ * Convenience class that allows the R/Rscript entry to be chosen by an initial argument.
+ */
+public class RMain {
+
+    public static void main(String[] args) {
+        boolean rscript = false;
+        if (args.length > 0) {
+            String arg = args[0];
+            switch (arg) {
+                case "R":
+                case "r":
+                    break;
+
+                case "Rscript":
+                case "rscript":
+                    rscript = true;
+                    break;
+
+                default:
+                    System.out.println(arg);
+                    usage();
+            }
+            String[] xargs = shiftArgs(args);
+            if (rscript) {
+                RscriptCommand.main(xargs);
+            } else {
+                RCommand.main(xargs);
+            }
+        } else {
+            usage();
+        }
+    }
+
+    private static void usage() {
+        System.out.println("usage: [R|Rscript] ...");
+        System.exit(1);
+    }
+
+    private static String[] shiftArgs(String[] args) {
+        String[] nargs = new String[args.length - 1];
+        System.arraycopy(args, 1, nargs, 0, nargs.length);
+        return nargs;
+    }
+
+}
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java
index 9b6d4cf9b5a68bd4fabafb8fba4cec531311df91..da182ef2025d0eb015b7f60f0c6231d871acfc84 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/RContext.java
@@ -71,6 +71,7 @@ import com.oracle.truffle.r.runtime.data.RFunction;
 import com.oracle.truffle.r.runtime.data.RList;
 import com.oracle.truffle.r.runtime.data.RNull;
 import com.oracle.truffle.r.runtime.data.RStringVector;
+import com.oracle.truffle.r.runtime.data.RTruffleObject;
 import com.oracle.truffle.r.runtime.env.REnvironment;
 import com.oracle.truffle.r.runtime.ffi.DLL;
 import com.oracle.truffle.r.runtime.ffi.RFFIFactory;
@@ -97,7 +98,7 @@ import com.oracle.truffle.r.runtime.rng.RRNG;
  * Contexts can be destroyed
  */
 @SuppressWarnings("deprecation")
-public final class RContext extends com.oracle.truffle.api.ExecutionContext {
+public final class RContext extends com.oracle.truffle.api.ExecutionContext implements RTruffleObject {
 
     public static final int CONSOLE_WIDTH = 80;
 
diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/managed/Managed_PCRERFFI.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/managed/Managed_PCRERFFI.java
index e0603452265439e902e0c86e105dcd067c85df87..622b78cc0cdd864ca1bb89675b6b7b85f6c2a8df 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/managed/Managed_PCRERFFI.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/managed/Managed_PCRERFFI.java
@@ -29,31 +29,31 @@ import com.oracle.truffle.r.runtime.ffi.PCRERFFI;
 public class Managed_PCRERFFI implements PCRERFFI {
     @Override
     public MaketablesNode createMaketablesNode() {
-        throw unsupported("PCRER");
+        throw unsupported("PCRE");
     }
 
     @Override
     public CompileNode createCompileNode() {
-        throw unsupported("PCRER");
+        throw unsupported("PCRE");
     }
 
     @Override
     public GetCaptureCountNode createGetCaptureCountNode() {
-        throw unsupported("PCRER");
+        throw unsupported("PCRE");
     }
 
     @Override
     public GetCaptureNamesNode createGetCaptureNamesNode() {
-        throw unsupported("PCRER");
+        throw unsupported("PCRE");
     }
 
     @Override
     public StudyNode createStudyNode() {
-        throw unsupported("PCRER");
+        throw unsupported("PCRE");
     }
 
     @Override
     public ExecNode createExecNode() {
-        throw unsupported("PCRER");
+        throw unsupported("PCRE");
     }
 }
diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/FastRJUnitWrapper.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/FastRJUnitWrapper.java
index eb1259935f1a066b448c81a3ff805a57f3d81c42..b38580ea0b6b5da7eb45fa6d70df00fd11bd37f7 100644
--- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/FastRJUnitWrapper.java
+++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/FastRJUnitWrapper.java
@@ -106,9 +106,8 @@ public class FastRJUnitWrapper {
 
                 ArrayList<Class<?>> tests = new ArrayList<>(1000);
                 try (BufferedReader br = new BufferedReader(new FileReader(testsFile))) {
-                    String className;
-                    while ((className = br.readLine()) != null) {
-                        tests.add(Class.forName(className));
+                    while ((testClassName = br.readLine()) != null) {
+                        tests.add(Class.forName(testClassName));
                     }
                 } catch (IOException ioe) {
                     ioe.printStackTrace();
diff --git a/mx.fastr/mx_fastr_junit.py b/mx.fastr/mx_fastr_junit.py
index 98aa47d398fb19e4b35b677ef1842a2bef0f42d2..9f9555149705ef90c8b13dcf8a98d88f8855b0ed 100644
--- a/mx.fastr/mx_fastr_junit.py
+++ b/mx.fastr/mx_fastr_junit.py
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,10 @@ def junit(args, harness, parser=None, jdk_default=None):
             if not found:
                 mx.warn('no tests matched by substring "' + t + '"')
 
-    vmArgs += mx.get_runtime_jvm_args([pcp.name for pcp in mx.projects(opt_limit_to_suite=True) if pcp.isJavaProject() and pcp.javaCompliance <= jdk.javaCompliance], jdk=jdk)
+    dists = ['FASTR', 'FASTR_UNIT_TESTS']
+    if mx.suite('r-apptests', fatalIfMissing=False):
+        dists.append('com.oracle.truffle.r.test.apps')
+    vmArgs += mx.get_runtime_jvm_args(dists, jdk=jdk)
 
     if len(classes) != 0:
         if len(classes) == 1:
diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py
index 75a963bb2e1dc78d1aad12b4c2afd1620391c650..b915323c9f59225b929f763f466f1f47938b95e8 100644
--- a/mx.fastr/suite.py
+++ b/mx.fastr/suite.py
@@ -319,7 +319,10 @@ suite = {
 
     "FASTR_UNIT_TESTS" : {
       "description" : "unit tests",
-      "dependencies" : ["com.oracle.truffle.r.test"],
+      "dependencies" : [
+        "com.oracle.truffle.r.test",
+        "com.oracle.truffle.r.nodes.test"
+       ],
       "exclude": ["mx:HAMCREST", "mx:JUNIT", "mx:JMH"],
       "distDependencies" : [
         "FASTR",