diff --git a/template.php b/template.php
new file mode 100644
index 0000000..7c6d1a9
--- /dev/null
+++ b/template.php
@@ -0,0 +1,37 @@
+<?php
+
+function adapt_preprocess_page(&$vars, $hook) {
+  // Print out Adapt settings in page templates
+  // Fall back for when JavaScript disabled
+  $noscript = '<noscript><link rel="stylesheet" href="' . base_path() . drupal_get_path('theme', 'adapt') . '/assets/css/mobile.min.css' . '" /></noscript>';
+  // Append noscript to styles
+  $vars['styles'] .= $noscript;
+
+  // Set up parameters to use Adapt.js, see http://adapt.960.gs
+  $adapt_js =
+    'var ADAPT_CONFIG = {
+      path: \'' . base_path() . drupal_get_path('theme', 'adapt') . '/assets/css/\',
+      dynamic: true,
+      range: [
+        \'760px            = mobile.min.css\',
+        \'760px  to 980px  = 720.min.css\',
+        \'980px  to 1280px = 960.min.css\',
+        \'1280px to 1600px = 1200.min.css\',
+        \'1600px to 1920px = 1560.min.css\',
+        \'1920px           = fluid.min.css\'
+      ]
+    };';
+
+  // Add script inline into page.tpl.php
+  drupal_add_js($adapt_js, 'inline');
+
+  // Add to the $scripts
+  $vars['scripts'] = drupal_get_js();
+
+  // Can't load the adapt.min.js before the inline script
+  // @TODO see if we can weight the scritps using drupal_add_js
+  // and $options rather than what is done below
+  $adapt_min = '<script type="text/javascript" src="' . base_path() . drupal_get_path('theme', 'adapt') . '/assets/js/adapt.min.js' . '"></script>';
+  $vars['scripts'] .= $adapt_min;
+
+}
\ No newline at end of file
diff --git a/tpl/page.tpl.php b/tpl/page.tpl.php
index 229f5bf..a824bea 100644
--- a/tpl/page.tpl.php
+++ b/tpl/page.tpl.php
@@ -1,30 +1,12 @@
 <!DOCTYPE html>
-<html lang="en">
+<html lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
 <head>
-  <meta charset="utf-8" />
-  <meta http-equiv="x-ua-compatible" content="ie=edge" />
-  <title><?php print $page_title; ?></title>
+  <?php print $head; ?>
+  <title><?php print $head_title; ?></title>
   <?php print $styles; ?>
-  <noscript>
-    <link rel="stylesheet" href="/<?php print $directory; ?>/assets/css/mobile.min.css" />
-  </noscript>
-  <script>
-    var ADAPT_CONFIG = {
-      path: '/<?php print $directory; ?>/assets/css/',
-      dynamic: true,
-      range: [
-        '760px            = mobile.min.css',
-        '760px  to 980px  = 720.min.css',
-        '980px  to 1280px = 960.min.css',
-        '1280px to 1600px = 1200.min.css',
-        '1600px to 1920px = 1560.min.css',
-        '1920px           = fluid.min.css'
-      ]
-    };
-  </script>
-  <script src="/<?php print $directory; ?>/assets/js/adapt.min.js"></script>
+  <?php print $scripts; ?>
 </head>
-<body>
+<body class="<?php print $body_classes; ?>">
 <div class="container_12 clearfix">
   <?php print $content; ?>
 </div>
