diff --git a/Text/Coffee.hs b/Text/Coffee.hs
--- a/Text/Coffee.hs
+++ b/Text/Coffee.hs
@@ -76,12 +76,11 @@
     , preEscapeIgnoreLine = "#"            -- ignore commented lines
     , wrapInsertion = Just WrapInsertion { 
         wrapInsertionIndent = Just "  "
-      , wrapInsertionStartBegin = "(("
+      , wrapInsertionStartBegin = "("
       , wrapInsertionSeparator = ", "
       , wrapInsertionStartClose = ") =>"
-      , wrapInsertionEnd = ")"
-      , wrapInsertionApplyBegin = "("
-      , wrapInsertionApplyClose = ")\n"
+      , wrapInsertionEnd = ""
+      , wrapInsertionAddParens = False
       }
     }
   }
diff --git a/Text/Roy.hs b/Text/Roy.hs
--- a/Text/Roy.hs
+++ b/Text/Roy.hs
@@ -9,10 +9,26 @@
 --
 -- To use this module, @roy@ must be installed on your system.
 --
--- Unfortunately variable interpolation in Roy does not currently work,
--- but it can with a small change to Roy:
--- <https://github.com/pufuwozu/roy/issues/165>
+-- If you interpolate variables,
+-- the template is first wrapped with a function containing javascript variables representing shakespeare variables,
+-- then compiled with @roy@,
+-- and then the value of the variables are applied to the function.
+-- This means that in production the template can be compiled
+-- once at compile time and there will be no dependency in your production
+-- system on @roy@. 
 --
+-- Your code:
+--
+-- > let b = 1
+-- > console.log(#{a} + b)
+--
+-- Final Result:
+--
+-- > ;(function(shakespeare_var_a){
+-- >   var b = 1;
+-- >   console.log(shakespeare_var_a + b);
+-- > })(#{a});
+--
 -- Further reading:
 --
 -- 1. Shakespearean templates: <http://www.yesodweb.com/book/templates>
@@ -45,21 +61,17 @@
   jsettings <- javascriptSettings
   return $ jsettings { varChar = '#'
   , preConversion = Just PreConvert {
-      preConvert = ReadProcess "roy" ["--stdio"]
+      preConvert = ReadProcess "roy" ["--stdio", "--browser"]
     , preEscapeIgnoreBalanced = "'\""
     , preEscapeIgnoreLine = "//"
-    , wrapInsertion = Nothing
-    {-
-    Just WrapInsertion { 
+    , wrapInsertion = Just WrapInsertion {
         wrapInsertionIndent = Just "  "
       , wrapInsertionStartBegin = "(\\"
       , wrapInsertionSeparator = " "
       , wrapInsertionStartClose = " ->\n"
       , wrapInsertionEnd = ")"
-      , wrapInsertionApplyBegin = " "
-      , wrapInsertionApplyClose = ")\n"
+      , wrapInsertionAddParens = True
       }
-      -}
     }
   }
 
diff --git a/Text/TypeScript.hs b/Text/TypeScript.hs
--- a/Text/TypeScript.hs
+++ b/Text/TypeScript.hs
@@ -88,8 +88,7 @@
       , wrapInsertionSeparator = ", "
       , wrapInsertionStartClose = "){"
       , wrapInsertionEnd = "})"
-      , wrapInsertionApplyBegin = "("
-      , wrapInsertionApplyClose = ");\n"
+      , wrapInsertionAddParens = False
       }
     }
   }
@@ -101,7 +100,7 @@
     quoteExp (shakespeare rs) s
     }
 
--- | Read in a Roy template file. This function reads the file once, at
+-- | Read in a TypeScript template file. This function reads the file once, at
 -- compile time.
 typeScriptFile :: FilePath -> Q Exp
 typeScriptFile fp = do
diff --git a/shakespeare-js.cabal b/shakespeare-js.cabal
--- a/shakespeare-js.cabal
+++ b/shakespeare-js.cabal
@@ -1,5 +1,5 @@
 name:            shakespeare-js
-version:         1.1.2.1
+version:         1.1.3
 license:         MIT
 license-file:    LICENSE
 author:          Michael Snoyman <michael@snoyman.com>
@@ -31,7 +31,7 @@
 
 library
     build-depends:   base             >= 4       && < 5
-                   , shakespeare      >= 1.0.3   && < 1.1
+                   , shakespeare      >= 1.0.4   && < 1.1
                    , template-haskell
                    , text             >= 0.7
                    , aeson            >= 0.5
diff --git a/test/ShakespeareJsTest.hs b/test/ShakespeareJsTest.hs
--- a/test/ShakespeareJsTest.hs
+++ b/test/ShakespeareJsTest.hs
@@ -83,10 +83,10 @@
         double = 3.14 :: Double
         int = -5 :: Int
 #ifdef TEST_COFFEE
-    in jelper "var _this = this;\n\n(function(shakespeare_var_rawJSDataListreversefoo, shakespeare_var_rawJSLreversefoo, shakespeare_var_rawJSshowdouble, shakespeare_var_rawJSshowint) {\n  return [shakespeare_var_rawJSDataListreversefoo, shakespeare_var_rawJSLreversefoo, shakespeare_var_rawJSshowdouble, shakespeare_var_rawJSshowint];\n})(oof, oof, 3.14, -5)"
+    in jelper "var _this = this;\n\n(function(shakespeare_var_rawJSDataListreversefoo, shakespeare_var_rawJSLreversefoo, shakespeare_var_rawJSshowdouble, shakespeare_var_rawJSshowint) {\n  return [shakespeare_var_rawJSDataListreversefoo, shakespeare_var_rawJSLreversefoo, shakespeare_var_rawJSshowdouble, shakespeare_var_rawJSshowint];\n})(oof, oof, 3.14, -5);\n"
 #else
 #  ifdef TEST_ROY
-    in jelper "(function(shakespeare_var_rawJSDataListreversefoo, shakespeare_var_rawJSLreversefoo, shakespeare_var_rawJSshowdouble, shakespeare_var_rawJSshowint) {\n  return [shakespeare_var_rawJSDataListreversefoo, shakespeare_var_rawJSLreversefoo, shakespeare_var_rawJSshowdouble, shakespeare_var_rawJSshowint];\n})(oof, oof, 3.14, -5)"
+    in jelper "(function(shakespeare_var_rawJSDataListreversefoo, shakespeare_var_rawJSLreversefoo, shakespeare_var_rawJSshowdouble, shakespeare_var_rawJSshowint) {\n    return [shakespeare_var_rawJSDataListreversefoo, shakespeare_var_rawJSLreversefoo, shakespeare_var_rawJSshowdouble, shakespeare_var_rawJSshowint];\n})(oof, oof, 3.14, -5);\n"
 #  else
     in jelper "[oof, oof, 3.14, -5]"
 #  endif
@@ -103,14 +103,29 @@
 
   it "dollar operator" $ do
     let val = (1 :: Int, (2 :: Int, 3 :: Int))
-#if !(defined TEST_COFFEE || defined TEST_ROY)
+#if (defined TEST_COFFEE)
+    jelper "var _this = this;\n\n(function(shakespeare_var_rawJSshowfstsndval) {\n  return shakespeare_var_rawJSshowfstsndval;\n})(2);\n" [quote|#{ rawJS $ show $ fst $ snd val }|]
+    jelper "var _this = this;\n\n(function(shakespeare_var_rawJSshowfstsndval) {\n  return shakespeare_var_rawJSshowfstsndval;\n})(2);\n" [quote|#{ rawJS $ show $ fst $ snd val }|]
+#else
+
+#  if (defined TEST_ROY)
+    jelper "(function(shakespeare_var_rawJSshowfstsndval) {\n    return shakespeare_var_rawJSshowfstsndval;\n})(2);\n" [quote|#{ rawJS $ show $ fst $ snd val }|]
+    jelper "(function(shakespeare_var_rawJSshowfstsndval) {\n    return shakespeare_var_rawJSshowfstsndval;\n})(2);\n" [quote|#{ rawJS $ show $ fst $ snd val }|]
+
+#  else
     jelper "2" [quote|#{ rawJS $ show $ fst $ snd val }|]
     jelper "2" [quote|#{ rawJS $ show $ fst $ snd $ val}|]
-#else
-    jelper "var _this = this;\n\n(function(shakespeare_var_rawJSshowfstsndval) {\n  return shakespeare_var_rawJSshowfstsndval;\n})(2)" [quote|#{ rawJS $ show $ fst $ snd val }|]
-    jelper "var _this = this;\n\n(function(shakespeare_var_rawJSshowfstsndval) {\n  return shakespeare_var_rawJSshowfstsndval;\n})(2)" [quote|#{ rawJS $ show $ fst $ snd val }|]
+#  endif
 #endif
 
+#if (defined TEST_ROY)
+  it "roy function wrapper" $ do
+    let royInsert = rawJS "\"royInsert\""
+    jelper "(function(shakespeare_var_royInsert) {\n    var roy = {\n        \"royInsert\": shakespeare_var_royInsert\n    };\n    return console.log(roy);\n})(\"royInsert\");\n" [quote|
+let roy = { royInsert: #{royInsert} }
+console.log roy
+|]
+#endif
   it "empty file" $ jelper "" [quote||]
 
   it "JSON data" $ jelper "\"Hello \\\"World!\\\"\"" [julius|#{toJSON "Hello \"World!\""}|]
