diff --git a/client/commonFramework.js b/client/commonFramework.js
index acbe741..613f644 100644
--- a/client/commonFramework.js
+++ b/client/commonFramework.js
@@ -7,23 +7,25 @@ var common = (function() {
     init: []
   };
 
-  common.challengeName = common.challengeName || window.challenge_Name ?
-    window.challenge_Name :
-    '';
+  common.challengeName = common.challengeName || window.challenge_Name || '';
 
-  common.challengeType = common.challengeType || window.challengeType ?
-    window.challengeType :
-    0;
+  common.challengeType = common.challengeType || window.challengeType || 0;
 
   common.challengeId = common.challengeId || window.challenge_Id;
 
-  common.challengeSeed = common.challengeSeed || window.challengeSeed ?
-    window.challengeSeed :
-    [];
+  common.challengeSeed = common.challengeSeed || window.challengeSeed || [];
 
-  common.seed = common.challengeSeed.reduce(function(seed, line) {
-    return seed + line + '\n';
-  }, '');
+  common.head = common.head || '';
+  common.tail = common.tail || '';
+
+  common.convertSeed = function(seedData) {
+    seedData = seedData || [];
+    return seedData.reduce(function(seed, line) {
+      return seed + line + '\n';
+    }, '');
+  };
+
+  common.seed = common.convertSeed(common.challengeSeed);
 
   common.replaceScriptTags = function replaceScriptTags(value) {
     return value
@@ -482,7 +484,7 @@ var editor = (function(CodeMirror, emmetCodeMirror, common) {
 }(window.CodeMirror, window.emmetCodeMirror, common));
 
 
-var tests = tests || [];
+var tests = common.tests || [];
 
 var libraryIncludes =
   "<script src='//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js'>" +
@@ -873,17 +875,8 @@ function updatePreview() {
   }
 }
 
-if (typeof prodOrDev !== 'undefined') {
-
-  /* eslint-disable no-unused-vars */
-  var nodeEnv = window.prodOrDev === 'production' ?
-    'http://www.freecodecamp.com' :
-    'http://localhost:3001';
-  /* eslint-enable no-unused-vars */
-
-  if (common.challengeType === '0') {
-    setTimeout(updatePreview, 300);
-  }
+if (common.challengeType === '0') {
+  setTimeout(updatePreview, 300);
 }
 
 /**
@@ -1119,7 +1112,10 @@ var reassembleTest = function(test, data) {
 };
 
 var runTests = function(err, data) {
-  var editorValue = editor.getValue();
+  var head = common.convertSeed(common.head);
+  var tail = common.convertSeed(common.tail);
+
+  var editorValue = head + editor.getValue() + tail;
   // userTests = userTests ? null : [];
   var allTestsPassed = true;
   pushed = false;
@@ -1371,6 +1367,8 @@ common.init.push((function() {
 }(window.$)));
 
 function bonfireExecute(shouldTest) {
+  var head = common.convertSeed(common.head);
+  var tail = common.convertSeed(common.tail);
   var codeOutput = common.codeOutput;
   initPreview = false;
   goodTests = 0;
@@ -1383,7 +1381,7 @@ function bonfireExecute(shouldTest) {
     common.challengeType !== '0' &&
     !editor.getValue().match(/\$\s*?\(\s*?\$\s*?\)/gi)
   ) {
-    var userJavaScript = editor.getValue();
+    var userJavaScript = head + editor.getValue() + tail;
     var failedCommentTest = false;
 
     var openingComments = userJavaScript.match(/\/\*/gi);
@@ -1502,7 +1500,7 @@ $(document).ready(function() {
         bonfireExecute(true);
       }
     });
-  } else if (common.challengeType !== 7) {
+  } else if (common.challengeType !== '7' && common.challengeType !== '2') {
     bonfireExecute(true);
   }
 
diff --git a/client/main.js b/client/main.js
index c8f08cb..5af41f2 100644
--- a/client/main.js
+++ b/client/main.js
@@ -4,6 +4,15 @@ main.mapShareKey = 'map-shares';
 
 main.ga = window.ga || function() {};
 
+main.challengeTypes = {
+  'HTML_CSS_JQ': '0',
+  'JAVASCRIPT': '1',
+  'VIDEO': '2',
+  'ZIPLINE': '3',
+  'BASEJUMP': '4',
+  'BONFIRE': '5'
+};
+
 main = (function(main) {
 
   // should be set before gitter script loads
@@ -103,6 +112,44 @@ main = (function(main) {
   return main;
 }(main));
 
+main.lockTop = function lockTop() {
+  var magiVal;
+
+  if ($(window).width() >= 990) {
+    if ($('.editorScrollDiv').html()) {
+
+      magiVal = $(window).height() -
+        $('.navbar').height() +
+        $('.footer').height();
+
+      if (magiVal < 0) {
+        magiVal = 0;
+      }
+      $('.editorScrollDiv').css('height', magiVal - 85 + 'px');
+    }
+
+    magiVal = $(window).height() -
+      $('.navbar').height() +
+      $('.footer').height();
+
+    if (magiVal < 0) {
+      magiVal = 0;
+    }
+
+    $('.scroll-locker')
+      .css('min-height', $('.editorScrollDiv').height())
+      .css('height', magiVal - 185);
+  } else {
+    $('.editorScrollDiv').css('max-height', 500 + 'px');
+
+    $('.scroll-locker')
+      .css('position', 'inherit')
+      .css('top', 'inherit')
+      .css('width', '100%')
+      .css('max-height', '85%');
+  }
+};
+
 var lastCompleted = typeof lastCompleted !== 'undefined' ?
   lastCompleted :
   '';
@@ -143,11 +190,11 @@ $(document).ready(function() {
     '';
 
   if (challengeName) {
-    ga('send', 'event',  'Challenge', 'load', challengeName);
+    ga('send', 'event', 'Challenge', 'load', challengeName);
   }
 
   if (typeof editor !== 'undefined') {
-    $('#reset-button').on('click', resetEditor);
+    $('#reset-button').on('click', window.resetEditor);
   }
 
   var CSRF_HEADER = 'X-CSRF-Token';
@@ -164,7 +211,7 @@ $(document).ready(function() {
 
   $('.checklist-element').each(function() {
     var checklistElementId = $(this).attr('id');
-    if(!!localStorage[checklistElementId]) {
+    if (localStorage[checklistElementId]) {
       $(this).children().children('li').addClass('faded');
       $(this).children().children('input').trigger('click');
     }
@@ -179,13 +226,14 @@ $(document).ready(function() {
 
   $('.challenge-list-checkbox').on('change', function() {
     var checkboxId = $(this).parent().parent().attr('id');
-    if ($(this).is(":checked")) {
+    if ($(this).is(':checked')) {
       $(this).parent().siblings().children().addClass('faded');
       if (!localStorage || !localStorage[checkboxId]) {
         localStorage[checkboxId] = true;
       }
     }
-    if (!$(this).is(":checked")) {
+
+    if (!$(this).is(':checked')) {
       $(this).parent().siblings().children().removeClass('faded');
       if (localStorage[checkboxId]) {
         localStorage.removeItem(checkboxId);
@@ -193,271 +241,294 @@ $(document).ready(function() {
     }
   });
 
-  $("img").error(function () {
-    $(this).unbind("error").attr("src", "https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png");
+  $('img').error(function() {
+    $(this)
+      .unbind('error')
+      .attr(
+        'src',
+        'https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png'
+      );
   });
 
-  function reBindModals(){
+  function reBindModals() {
+    if (!window.common) {
+      throw new Error('common framework should be loaded.');
+    }
+    var common = window.common;
 
-      $('.close-modal').unbind('click');
-      $('.close-modal').on('click', function(){
-        setTimeout(function() {
-            $('.close-modal').parent().parent().parent().parent().modal('hide');
-        }, 200);
-      });
+    $('.close-modal').unbind('click');
+    $('.close-modal').on('click', function() {
+      setTimeout(function() {
+          $('.close-modal').parent().parent().parent().parent().modal('hide');
+      }, 200);
+    });
 
-      $('#search-issue').unbind('click');
-      $('#search-issue').on('click', function() {
-          var queryIssue = window.location.href.toString().split('#?')[0];
-          window.open('https://github.com/FreeCodeCamp/FreeCodeCamp/issues?q=' +
-            'is:issue is:all ' + (challenge_Name || challengeName) + ' OR ' +
-            queryIssue.substr(queryIssue.lastIndexOf('challenges/') + 11)
-            .replace('/', ''), '_blank');
-      });
+    $('#search-issue').unbind('click');
+    $('#search-issue').on('click', function() {
+      var queryIssue = window.location.href.toString();
+      window.open(
+        'https://github.com/FreeCodeCamp/FreeCodeCamp/issues?q=' +
+        'is:issue is:all ' +
+        (common.challengeName) +
+        ' OR ' +
+        queryIssue
+          .substr(queryIssue.lastIndexOf('challenges/') + 11)
+          .replace('/', ''), '_blank');
+    });
 
-      $('#gist-share').unbind('click');
-      $('#gist-share').on('click', function() {
-        var gistWindow = window.open('', '_blank');
-
-        $('#gist-share')
-          .attr('disabled', 'true')
-          .removeClass('btn-danger')
-          .addClass('btn-warning disabled');
-
-        function createCORSRequest(method, url) {
-          var xhr = new XMLHttpRequest();
-          if ('withCredentials' in xhr) {
-            xhr.open(method, url, true);
-          } else if (typeof XDomainRequest !== 'undefined') {
-            xhr = new XDomainRequest();
-            xhr.open(method, url);
-          } else {
-            xhr = null;
-          }
-          xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8');
-          return xhr;
+    $('#gist-share').unbind('click');
+    $('#gist-share').on('click', function() {
+      var gistWindow = window.open('', '_blank');
+
+      $('#gist-share')
+        .attr('disabled', 'true')
+        .removeClass('btn-danger')
+        .addClass('btn-warning disabled');
+
+      function createCORSRequest(method, url) {
+        var xhr = new XMLHttpRequest();
+        if ('withCredentials' in xhr) {
+          xhr.open(method, url, true);
+        } else if (typeof XDomainRequest !== 'undefined') {
+          xhr = new XDomainRequest();
+          xhr.open(method, url);
+        } else {
+          xhr = null;
         }
+        xhr.setRequestHeader('Content-type', 'application/json; charset=utf-8');
+        return xhr;
+      }
 
-        var request = createCORSRequest('post', 'https://api.github.com/gists');
-        if (request) {
-          request.onload = function() {
-            if (request.readyState === 4 &&
-                request.status === 201 &&
-                request.statusText === 'Created') {
-              gistWindow.location.href = JSON.parse(request.responseText)['html_url'];
-            }
-          };
-          var data = {
-            description: (username ? 'http://www.freecodecamp.com/' + username +
-            ' \'s s' : 'S') + 'olution for ' + (challenge_Name || challengeName),
-            public: true,
-            files: {}
-          },
-          queryIssue = window.location.href.toString().split('#?')[0],
-          filename = queryIssue
-          .substr(queryIssue.lastIndexOf('challenges/') + 11)
-          .replace('/', '') + '.js';
-          data['files'][filename] = {
-            content: '// ' + (challenge_Name || challengeName) + '\n' +
-            (username ? '// Author: @' + username + '\n' : '') +
-            '// Challenge: ' + queryIssue + '\n' +
-            '// Learn to Code at Free Code Camp (www.freecodecamp.com)' +
-            '\n\n' + editor.getValue().trim()
-          };
-
-          request.send(JSON.stringify(data));
-        }
-      });
+      var request = createCORSRequest('post', 'https://api.github.com/gists');
+      if (request) {
+        request.onload = function() {
+          if (request.readyState === 4 &&
+              request.status === 201 &&
+              request.statusText === 'Created') {
+            gistWindow.location.href = JSON.parse(request.responseText)['html_url'];
+          }
+        };
+        var data = {
+          description: (username ? 'http://www.freecodecamp.com/' + username +
+          ' \'s s' : 'S') + 'olution for ' + (challenge_Name || challengeName),
+          public: true,
+          files: {}
+        },
+        queryIssue = window.location.href.toString().split('#?')[0],
+        filename = queryIssue
+        .substr(queryIssue.lastIndexOf('challenges/') + 11)
+        .replace('/', '') + '.js';
+        data['files'][filename] = {
+          content: '// ' + (challenge_Name || challengeName) + '\n' +
+          (username ? '// Author: @' + username + '\n' : '') +
+          '// Challenge: ' + queryIssue + '\n' +
+          '// Learn to Code at Free Code Camp (www.freecodecamp.com)' +
+          '\n\n' + editor.getValue().trim()
+        };
 
-      $('#help-ive-found-a-bug-wiki-article').unbind('click');
-      $('#help-ive-found-a-bug-wiki-article').on('click', function() {
-        window.open("https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/Help-I've-Found-a-Bug", '_blank');
-      });
+        request.send(JSON.stringify(data));
+      }
+    });
 
-      $('#report-issue').unbind('click');
-      $('#report-issue').on('click', function() {
-          var textMessage = [
-            'Challenge [',
-            (challenge_Name || challengeName || window.location.href),
-            '](',
-            window.location.href,
-            ') has an issue.\n',
-            'User Agent is: <code>',
-            navigator.userAgent,
-            '</code>.\n',
-            'Please describe how to reproduce this issue, and include ',
-            'links to screenshots if possible.\n\n'
-          ].join('');
-
-          if (typeof editor !== 'undefined' && editor.getValue().trim()) {
-            var type;
-            switch (challengeType) {
-              case challengeTypes.HTML_CSS_JQ:
-                type = 'html';
-                break;
-              case challengeTypes.JAVASCRIPT:
-              case challengeTypes.BONFIRE:
-                type = 'javascript';
-                break;
-              default:
-                type = '';
-            }
+    $('#help-ive-found-a-bug-wiki-article').unbind('click');
+    $('#help-ive-found-a-bug-wiki-article').on('click', function() {
+      window.open(
+        'https://github.com/FreeCodeCamp/FreeCodeCamp/wiki/' +
+          "Help-I've-Found-a-Bug",
+        '_blank'
+      );
+    });
 
-            textMessage += [
-              'My code:\n```',
-              type,
-              '\n',
-              editor.getValue(),
-              '\n```\n\n'
-            ].join('');
-          }
+    $('#report-issue').unbind('click');
+    $('#report-issue').on('click', function() {
+      var textMessage = [
+        'Challenge [',
+        (common.challengeName || window.location.href),
+        '](',
+        window.location.href,
+        ') has an issue.\n',
+        'User Agent is: <code>',
+        navigator.userAgent,
+        '</code>.\n',
+        'Please describe how to reproduce this issue, and include ',
+        'links to screenshots if possible.\n\n'
+      ].join('');
+
+      if (
+        window.editor &&
+        typeof window.editor.getValue === 'function' &&
+        window.editor.getValue().trim()
+      ) {
+        var type;
+        switch (common.challengeType) {
+          case main.challengeTypes.HTML_CSS_JQ:
+            type = 'html';
+            break;
+          case main.challengeTypes.JAVASCRIPT:
+          case main.challengeTypes.BONFIRE:
+            type = 'javascript';
+            break;
+          default:
+            type = '';
+        }
 
-          textMessage = encodeURIComponent(textMessage);
+        textMessage += [
+          'My code:\n```',
+          type,
+          '\n',
+          window.editor.getValue(),
+          '\n```\n\n'
+        ].join('');
+      }
 
-          $('#issue-modal').modal('hide');
-          window.open(
-            'https://github.com/freecodecamp/freecodecamp/issues/new?&body=' +
-            textMessage, '_blank'
-          );
-      });
+      textMessage = encodeURIComponent(textMessage);
 
-      $('#completed-courseware').unbind('click');
-      $('#completed-courseware').on('click', function() {
-          $('#complete-courseware-dialog').modal('show');
-      });
+      $('#issue-modal').modal('hide');
+      window.open(
+        'https://github.com/freecodecamp/freecodecamp/issues/new?&body=' +
+        textMessage, '_blank'
+      );
+    });
 
-      $('#completed-courseware-editorless').unbind('click');
-      $('#completed-courseware-editorless').on('click', function() {
-          $('#complete-courseware-editorless-dialog').modal('show');
-      });
+    $('#completed-courseware').unbind('click');
+    $('#completed-courseware').on('click', function() {
+        $('#complete-courseware-dialog').modal('show');
+    });
 
-      $('#trigger-pair-modal').unbind('click');
-      $('#trigger-pair-modal').on('click', function() {
-          $('#pair-modal').modal('show');
-      });
+    $('#completed-courseware-editorless').unbind('click');
+    $('#completed-courseware-editorless').on('click', function() {
+        $('#complete-courseware-editorless-dialog').modal('show');
+    });
 
-      $('#trigger-reset-modal').unbind('click');
-      $('#trigger-reset-modal').on('click', function() {
-          $('#reset-modal').modal('show');
-      });
+    $('#trigger-pair-modal').unbind('click');
+    $('#trigger-pair-modal').on('click', function() {
+        $('#pair-modal').modal('show');
+    });
 
-      $('#trigger-help-modal').unbind('click');
-      $('#trigger-help-modal').on('click', function() {
-          $('#help-modal').modal('show');
-      });
+    $('#trigger-reset-modal').unbind('click');
+    $('#trigger-reset-modal').on('click', function() {
+        $('#reset-modal').modal('show');
+    });
 
-      $('#trigger-issue-modal').unbind('click');
-      $('#trigger-issue-modal').on('click', function() {
-          $('#issue-modal').modal('show');
-      });
+    $('#trigger-help-modal').unbind('click');
+    $('#trigger-help-modal').on('click', function() {
+        $('#help-modal').modal('show');
+    });
 
-      $('#completed-zipline-or-basejump').unbind('click');
-      $('#completed-zipline-or-basejump').on('click', function() {
-          $('#complete-zipline-or-basejump-dialog').modal('show');
-      });
+    $('#trigger-issue-modal').unbind('click');
+    $('#trigger-issue-modal').on('click', function() {
+        $('#issue-modal').modal('show');
+    });
+
+    $('#completed-zipline-or-basejump').unbind('click');
+    $('#completed-zipline-or-basejump').on('click', function() {
+        $('#complete-zipline-or-basejump-dialog').modal('show');
+    });
 
+    $('#next-courseware-button').unbind('click');
+    $('#next-courseware-button').on('click', function() {
       $('#next-courseware-button').unbind('click');
-      $('#next-courseware-button').on('click', function() {
-          $('#next-courseware-button').unbind('click');
-          if ($('.signup-btn-nav').length < 1) {
-              switch (challengeType) {
-                  case challengeTypes.HTML_CSS_JQ:
-                  case challengeTypes.JAVASCRIPT:
-                  case challengeTypes.VIDEO:
-                      $.post(
-                          '/completed-challenge/',
-                          {
-                              challengeInfo: {
-                                  challengeId: challenge_Id,
-                                  challengeName: challenge_Name
-                              }
-                          }).success(
-                          function(res) {
-                              if (res) {
-                                  window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
-                              }
-                          }).fail(
-                          function() {
-                              window.location.href="/challenges";
-                          }
-                      );
-                      break;
-                  case challengeTypes.ZIPLINE:
-                      var didCompleteWith = $('#completed-with').val() || null;
-                      var publicURL = $('#public-url').val() || null;
-                      $.post(
-                          '/completed-zipline-or-basejump/',
-                          {
-                              challengeInfo: {
-                                  challengeId: challenge_Id,
-                                  challengeName: challenge_Name,
-                                  completedWith: didCompleteWith,
-                                  publicURL: publicURL,
-                                  challengeType: challengeType
-                              }
-                          }).success(
-                          function() {
-                              window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
-                          }).fail(
-                          function() {
-                              window.location.href = '/challenges';
-                          });
-                      break;
-                  case challengeTypes.BASEJUMP:
-                      var didCompleteWith = $('#completed-with').val() || null;
-                      var publicURL = $('#public-url').val() || null;
-                      var githubURL = $('#github-url').val() || null;
-                      $.post(
-                          '/completed-zipline-or-basejump/',
-                          {
-                              challengeInfo: {
-                                  challengeId: challenge_Id,
-                                  challengeName: challenge_Name,
-                                  completedWith: didCompleteWith,
-                                  publicURL: publicURL,
-                                  githubURL: githubURL,
-                                  challengeType: challengeType,
-                                  verified: false
-                              }
-                          }).success(function() {
-                              window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
-                          }).fail(function() {
-                              window.location.replace(window.location.href);
-                          });
-                      break;
-                  case challengeTypes.BONFIRE:
-                      window.location.href = '/challenges/next-challenge?id=' + challenge_Id;
-                  default:
-                      break;
+      if ($('.signup-btn-nav').length < 1) {
+        var data;
+        var completedWith;
+        var publicURL;
+        switch (common.challengeType) {
+          case main.challengeTypes.HTML_CSS_JQ:
+          case main.challengeTypes.JAVASCRIPT:
+          case main.challengeTypes.VIDEO:
+            data = {
+              challengeInfo: {
+                challengeId: common.challengeId,
+                challengeName: common.challengeName
               }
-          }
-      });
+            };
+            $.post('/completed-challenge/', data)
+              .success(function(res) {
+                if (!res) {
+                  return;
+                }
+                window.location.href = '/challenges/next-challenge?id=' +
+                  common.challengeId;
+              })
+              .fail(function() {
+                window.location.href = '/challenges';
+              });
 
-      $('#complete-courseware-dialog').on('hidden.bs.modal', function() {
-          editor.focus();
-      });
+            break;
+          case main.challengeTypes.ZIPLINE:
+            completedWith = $('#completed-with').val() || null;
+            publicURL = $('#public-url').val() || null;
+            data = {
+              challengeInfo: {
+                challengeId: common.challengeId,
+                challengeName: common.challengeName,
+                completedWith: completedWith,
+                publicURL: publicURL,
+                challengeType: common.challengeType
+              }
+            };
+
+            $.post('/completed-zipline-or-basejump/', data)
+              .success(function() {
+                window.location.href = '/challenges/next-challenge?id=' +
+                  common.challengeId;
+              })
+              .fail(function() {
+                window.location.href = '/challenges';
+              });
+            break;
+
+          case main.challengeTypes.BASEJUMP:
+            completedWith = $('#completed-with').val() || null;
+            publicURL = $('#public-url').val() || null;
+            var githubURL = $('#github-url').val() || null;
+            data = {
+              challengeInfo: {
+                challengeId: common.challengeId,
+                challengeName: common.challengeName,
+                completedWith: completedWith,
+                publicURL: publicURL,
+                githubURL: githubURL,
+                challengeType: common.challengeType,
+                verified: false
+              }
+            };
+            $.post('/completed-zipline-or-basejump/', data)
+              .success(function() {
+                window.location.href = '/challenges/next-challenge?id=' +
+                  common.challengeId;
+              })
+              .fail(function() {
+                window.location.replace(window.location.href);
+              });
+            break;
 
-      $('#complete-zipline-or-basejump').on('hidden.bs.modal', function() {
-          editor.focus();
-      });
-  };
+          case main.challengeTypes.BONFIRE:
+            window.location.href = '/challenges/next-challenge?id=' +
+              common.challengeId;
+            break;
 
+          default:
+            console.log('Happy Coding!');
+            break;
+          }
+      }
+    });
 
+    $('#complete-courseware-dialog').on('hidden.bs.modal', function() {
+      window.editor.focus();
+    });
 
-    $(window).resize(function(){
-        reBindModals();
+    $('#complete-zipline-or-basejump').on('hidden.bs.modal', function() {
+      window.editor.focus();
     });
+  }
 
+  $(window).resize(function() {
     reBindModals();
+  });
 
-  var challengeTypes = {
-    'HTML_CSS_JQ': '0',
-    'JAVASCRIPT': '1',
-    'VIDEO': '2',
-    'ZIPLINE': '3',
-    'BASEJUMP': '4',
-    'BONFIRE': '5'
-  };
+  reBindModals();
 
   function upvoteHandler(e) {
     e.preventDefault();
@@ -474,16 +545,19 @@ $(document).ready(function() {
     }
     if (!alreadyUpvoted) {
       $.post('/stories/upvote', { id: id })
-        .fail(function(xhr, textStatus, errorThrown) {
+        .fail(function() {
           $(upvoteBtn).bind('click', upvoteHandler);
         })
-        .done(function(data, textStatus, xhr) {
-          $(upvoteBtn).text('Upvoted!').addClass('disabled');
+        .done(function(data) {
+          $(upvoteBtn)
+            .text('Upvoted!')
+            .addClass('disabled');
 
-          $('#storyRank').text(data.rank + " points");
+          $('#storyRank').text(data.rank + ' points');
         });
     }
-  };
+  }
+
   $('#story-list').on('click', 'button.btn-upvote', upvoteHandler);
 
   var storySubmitButtonHandler = function storySubmitButtonHandler() {
@@ -491,91 +565,121 @@ $(document).ready(function() {
     var link = $('#story-url').val();
     var headline = $('#story-title').val();
     var description = $('#description-box').val();
+    var data = {
+      data: {
+        link: link,
+        headline: headline,
+        timePosted: Date.now(),
+        description: description,
+        storyMetaDescription: main.storyMetaDescription,
+        rank: 1,
+        image: main.storyImage
+      }
+    };
 
     $('#story-submit').unbind('click');
-    $.post('/stories/',
-      {
-        data: {
-          link: link,
-          headline: headline,
-          timePosted: Date.now(),
-          description: description,
-          storyMetaDescription: storyMetaDescription,
-          rank: 1,
-          image: storyImage
-        }
-      })
-      .fail(function (xhr, textStatus, errorThrown) {
+    $.post('/stories/', data)
+      .fail(function() {
         $('#story-submit').bind('click', storySubmitButtonHandler);
       })
-      .done(function(data, textStatus, xhr) {
+      .done(function(data) {
         window.location = '/stories/' + data.storyLink;
       });
   };
 
   $('#story-submit').on('click', storySubmitButtonHandler);
-    //fakeiphone positioning hotfix
-    if($('.iphone-position').html() !==undefined || $('.iphone').html() !== undefined){
-        var startIphonePosition = parseInt($('.iphone-position').css('top').replace('px', ''));
-        var startIphone = parseInt($('.iphone').css('top').replace('px', ''));
-        $(window).on('scroll', function(){
-            if((($('.courseware-height').height() + $('.courseware-height').offset().top)-$(window).scrollTop()-$('.iphone-position').height()) <= 0){
-                $('.iphone-position').css('top', startIphonePosition+(($('.courseware-height').height() + $('.courseware-height').offset().top)-$(window).scrollTop()-$('.iphone-position').height()));
-                $('.iphone').css('top', startIphonePosition+(($('.courseware-height').height() + $('.courseware-height').offset().top)-$(window).scrollTop()-$('.iphone-position').height())+120);
-            }
-            else{
-                $('.iphone-position').css('top', startIphonePosition);
-                $('.iphone').css('top', startIphone);
-            }
-        });
+
+  // fakeiphone positioning hotfix
+  if (
+    $('.iphone-position').html() ||
+    $('.iphone').html()
+  ) {
+    var startIphonePosition = parseInt(
+      $('.iphone-position')
+        .css('top')
+        .replace('px', ''),
+      10
+    );
+
+    var startIphone = parseInt(
+      $('.iphone')
+        .css('top')
+        .replace('px', ''),
+      10
+    );
+
+    $(window).on('scroll', function() {
+      var courseHeight = $('.courseware-height').height();
+      var courseTop = $('.courseware-height').offset().top;
+      var windowScrollTop = $(window).scrollTop();
+      var phoneHeight = $('.iphone-position').height();
+
+      if (courseHeight + courseTop - windowScrollTop - phoneHeight <= 0) {
+        $('.iphone-position').css(
+          'top',
+          startIphonePosition +
+            courseHeight +
+            courseTop -
+            windowScrollTop -
+            phoneHeight
+        );
+
+        $('.iphone').css(
+          'top',
+          startIphonePosition +
+            courseHeight +
+            courseTop -
+            windowScrollTop -
+            phoneHeight +
+            120
+        );
+      } else {
+        $('.iphone-position').css('top', startIphonePosition);
+        $('.iphone').css('top', startIphone);
+      }
+    });
+  }
+
+  if ($('.scroll-locker').html()) {
+
+    if ($('.scroll-locker').html()) {
+      main.lockTop();
+      $(window).on('resize', function() {
+        main.lockTop();
+      });
+      $(window).on('scroll', function() {
+        main.lockTop();
+      });
     }
-   if($('.scroll-locker').html() != undefined){
-        function lockTop(){
-            if ($(window).width() >= 990) {
-                if($('.editorScrollDiv').html() !== 'undefined'){
-                    var magiVal = $(window).height()-($('.navbar').height()+$('.footer').height());
-                    if(magiVal < 0){
-                        magiVal = 0;
-                    }
-                    $('.editorScrollDiv').css("height", (magiVal-85) + "px");
-                }
-                magiVal = $(window).height()-($('.navbar').height()+$('.footer').height());
-                if(magiVal < 0){
-                    magiVal = 0;
-                }
 
-                $('.scroll-locker').css("min-height", $('.editorScrollDiv').height()).css("height",magiVal-185);
-            }
-            else {
-                $('.editorScrollDiv').css("max-height", 500 + "px");
-                $('.scroll-locker').css('position', 'inherit').css('top', 'inherit').css('width', '100%').css('max-height', '85%');
+    var execInProgress = false;
+
+    // why is this not $???
+    document
+      .getElementById('scroll-locker')
+      .addEventListener(
+        'previewUpdateSpy',
+        function(e) {
+          if (execInProgress) {
+            return null;
+          }
+          execInProgress = true;
+          setTimeout(function() {
+            if (
+              $($('.scroll-locker').children()[0]).height() - 800 > e.detail
+            ) {
+              $('.scroll-locker').scrollTop(e.detail);
+            } else {
+              var scrollTop = $($('.scroll-locker').children()[0]).height();
+
+              $('.scroll-locker').animate({ scrollTop: scrollTop }, 175);
             }
-        }
-        if ($('.scroll-locker').html()){
-            lockTop();
-            $(window).on('resize', function(){
-              lockTop();
-            });
-            $(window).on('scroll', function() {
-              lockTop();
-            });
-        }
-       var execInProgress = false;
-       document.getElementById('scroll-locker').addEventListener('previewUpdateSpy', function(e){
-           if (!execInProgress){
-               execInProgress = true;
-               setTimeout(function(){
-                   if($($('.scroll-locker').children()[0]).height()-800 > e.detail){
-                       $('.scroll-locker').scrollTop(e.detail);
-                   }
-                   else {
-                       $('.scroll-locker').animate({"scrollTop":$($('.scroll-locker').children()[0]).height()}, 175);
-                   }
-                   execInProgress = false;
-               }, 750);
-           }
-       }, false);
-    }
+            execInProgress = false;
+          }, 750);
+        },
+        false
+      );
+  }
 
 
   // map sharing
@@ -613,141 +717,153 @@ $(document).ready(function() {
   });
 });
 
-function defCheck(a){
-    if(a !== 'undefined'){return(true);}else{return(false);}
-}
-
-var profileValidation = angular.module('profileValidation',
-  ['ui.bootstrap']);
-profileValidation.controller('profileValidationController', ['$scope', '$http',
-  function($scope, $http) {
-    $http.get('/account/api').success(function(data) {
-      $scope.user = data.user;
-      $scope.user.username = $scope.user.username ? $scope.user.username.toLowerCase() : undefined;
-      $scope.storedUsername = data.user.username;
-      $scope.storedEmail = data.user.email;
-      $scope.user.email = $scope.user.email ? $scope.user.email.toLowerCase() : undefined;
-      $scope.user.twitterHandle = $scope.user.twitterHandle ? $scope.user.twitterHandle.toLowerCase() : undefined;
-      $scope.asyncComplete = true;
-    });
-  }
-]);
-
-profileValidation.controller('pairedWithController', ['$scope',
-  function($scope) {
-    $scope.existingUser = null;
-  }
-]);
-
-profileValidation.controller('emailSignUpController', ['$scope',
-  function($scope) {
-
-  }
-]);
-
-profileValidation.controller('emailSignInController', ['$scope',
-  function($scope) {
-
-  }
-]);
-
-profileValidation.controller('URLSubmitController', ['$scope',
-  function($scope) {
-
-  }
-]);
-
-profileValidation.controller('nonprofitFormController', ['$scope',
-  function($scope) {
-
-  }
-]);
-
-profileValidation.controller('doneWithFirst100HoursFormController', ['$scope',
-  function($scope) {
-
-  }
-]);
-
-profileValidation.controller('submitStoryController', ['$scope',
-  function($scope) {
-
-  }
-]);
-
-profileValidation.directive('uniqueUsername', ['$http', function($http) {
-  return {
-    restrict: 'A',
-    require: 'ngModel',
-    link: function (scope, element, attrs, ngModel) {
-      element.bind("keyup", function (event) {
-        ngModel.$setValidity('unique', true);
-        var username = element.val();
-        if (username) {
-          var config = { params: { username: username } };
-          $http
-            .get('/api/users/exists', config)
-            .success(function (result) {
-              if (username === scope.storedUsername) {
-                ngModel.$setValidity('unique', true);
-              } else if (result.exists) {
-                ngModel.$setValidity('unique', false);
-              }
-            });
-        }
+var profileValidation =
+  window.angular.module('profileValidation', ['ui.bootstrap']);
+
+profileValidation.controller(
+  'profileValidationController',
+  [
+    '$scope',
+    '$http',
+    function($scope, $http) {
+      $http.get('/account/api').success(function(data) {
+        $scope.user = data.user;
+
+        $scope.user.username = $scope.user.username ?
+          $scope.user.username.toLowerCase() :
+          null;
+
+        $scope.storedUsername = data.user.username;
+        $scope.storedEmail = data.user.email;
+        $scope.user.email = $scope.user.email ?
+          $scope.user.email.toLowerCase() :
+          null;
+
+        $scope.user.twitterHandle = $scope.user.twitterHandle ?
+          $scope.user.twitterHandle.toLowerCase() :
+          null;
+
+        $scope.asyncComplete = true;
       });
     }
-  };
-}]);
+  ]
+);
+
+profileValidation.controller(
+  'pairedWithController',
+  [
+    '$scope',
+    function($scope) { $scope.existingUser = null; }
+  ]
+);
+
+profileValidation.controller('emailSignUpController', function() {});
+
+profileValidation.controller('emailSignInController', function() {});
+
+profileValidation.controller('URLSubmitController', function() {});
+
+profileValidation.controller('nonprofitFormController', function() {});
+
+profileValidation.controller(
+  'doneWithFirst100HoursFormController',
+  function() {}
+);
+
+profileValidation.controller('submitStoryController', function() {});
+
+profileValidation.directive(
+  'uniqueUsername',
+  [
+    '$http',
+    function($http) {
+      return {
+        restrict: 'A',
+        require: 'ngModel',
+        link: function(scope, element, attrs, ngModel) {
+
+          element.bind('keyup', function() {
+
+            ngModel.$setValidity('unique', true);
+            var username = element.val();
+            if (username) {
+              var config = { params: { username: username } };
+              $http
+                .get('/api/users/exists', config)
+                .success(function(result) {
+                  if (username === scope.storedUsername) {
+                    ngModel.$setValidity('unique', true);
+                  } else if (result.exists) {
+                    ngModel.$setValidity('unique', false);
+                  }
+                });
+            }
+          });
+        }
+      };
+    }
+  ]
+);
 
 profileValidation.directive('existingUsername',
-  ['$http', function($http) {
-    return {
-      restrict: 'A',
-      require: 'ngModel',
-      link: function (scope, element, attrs, ngModel) {
-        element.bind('keyup', function (event) {
-          if (element.val().length > 0) {
-            ngModel.$setValidity('exists', false);
-          } else {
-            element.removeClass('ng-dirty');
-            ngModel.$setPristine();
-          }
-          var username = element.val();
-          if (username) {
-            var config = { params: { username: username } };
-            $http
-              .get('/api/users/exists', config)
-              .success(function(result) {
-                ngModel.$setValidity('exists', result.exists);
-              });
-          }
-        });
-      }
-    };
+  [
+    '$http',
+    function($http) {
+      return {
+        restrict: 'A',
+        require: 'ngModel',
+        link: function(scope, element, attrs, ngModel) {
+
+          element.bind('keyup', function() {
+
+            if (element.val().length > 0) {
+              ngModel.$setValidity('exists', false);
+            } else {
+              element.removeClass('ng-dirty');
+              ngModel.$setPristine();
+            }
+
+            var username = element.val();
+            if (username) {
+              var config = { params: { username: username } };
+              $http
+                .get('/api/users/exists', config)
+                .success(function(result) {
+                  ngModel.$setValidity('exists', result.exists);
+                });
+            }
+          });
+        }
+      };
   }]);
 
-profileValidation.directive('uniqueEmail', ['$http', function($http) {
-  return {
-    restrict: 'A',
-    require: 'ngModel',
-    link: function getUnique (scope, element, attrs, ngModel) {
-      element.bind("keyup", function (event) {
-        ngModel.$setValidity('unique', true);
-        var email = element.val();
-        if (email) {
-          var config = { params: { email: email } };
-          $http
-            .get('/api/users/exists', config)
-            .success(function(result) {
-              if (email === scope.storedEmail) {
-                ngModel.$setValidity('unique', true);
-              } else if (result.exists) {
-                ngModel.$setValidity('unique', false);
-              }
-            });
-        };
-      });
+profileValidation.directive(
+  'uniqueEmail',
+  [
+    '$http',
+    function($http) {
+      return {
+        restrict: 'A',
+        require: 'ngModel',
+        link: function getUnique(scope, element, attrs, ngModel) {
+          element.bind('keyup', function() {
+            ngModel.$setValidity('unique', true);
+            var email = element.val();
+            if (email) {
+              var config = { params: { email: email } };
+              $http
+                .get('/api/users/exists', config)
+                .success(function(result) {
+                  if (email === scope.storedEmail) {
+                    ngModel.$setValidity('unique', true);
+                  } else if (result.exists) {
+                    ngModel.$setValidity('unique', false);
+                  }
+                });
+            }
+          });
+        }
+      };
     }
-  }
-}]);
+  ]
+);
diff --git a/common/models/challenge.json b/common/models/challenge.json
index 729cb97..72953fa 100644
--- a/common/models/challenge.json
+++ b/common/models/challenge.json
@@ -44,6 +44,16 @@
     "tests": {
       "type": "array"
     },
+    "head": {
+      "type": "array",
+      "default": [],
+      "description": "appended to user code"
+    },
+    "tail": {
+      "type": "array",
+      "default": [],
+      "description": "prepended to user code"
+    },
     "challengeSeed": {
       "type": "array"
     },
diff --git a/seed/challenges/basic-javascript.json b/seed/challenges/basic-javascript.json
index fd7ac4e..6d68739 100644
--- a/seed/challenges/basic-javascript.json
+++ b/seed/challenges/basic-javascript.json
@@ -44,8 +44,9 @@
         "  return false;",
         "",
         "// Only change code above this line.",
-        "}",
-        "",
+        "}"
+      ],
+      "tail": [
         "welcomeToBooleans();"
       ],
       "type": "waypoint",
@@ -67,9 +68,9 @@
       "challengeSeed": [
         "var ourName = \"Free Code Camp\";",
         "",
-        "",
-        "// Only change code above this line.",
-        "",
+        ""
+      ],
+      "tail": [
         "if(typeof(myName) !== \"undefined\"){(function(v){return v;})(myName);}"
       ],
       "type": "waypoint",
diff --git a/server/boot/challenge.js b/server/boot/challenge.js
index 92cebc5..69e9298 100644
--- a/server/boot/challenge.js
+++ b/server/boot/challenge.js
@@ -288,27 +288,34 @@ module.exports = function(app) {
 
         // save user does nothing if user does not exist
         return Observable.just({
+
           title: challenge.name,
-          dashedName: origChallengeName,
           name: challenge.name,
           details: challenge.description,
           description: challenge.description,
-          tests: challenge.tests,
-          challengeSeed: challenge.challengeSeed,
-          verb: utils.randomVerb(),
-          phrase: utils.randomPhrase(),
-          compliment: utils.randomCompliment(),
           challengeId: challenge.id,
           challengeType: challenge.challengeType,
+          dashedName: origChallengeName,
+
+          challengeSeed: challenge.challengeSeed,
+          head: challenge.head,
+          tail: challenge.tail,
+          tests: challenge.tests,
+
           // video challenges
           video: challenge.challengeSeed[0],
+
           // bonfires specific
-          difficulty: Math.floor(+challenge.difficulty),
           bonfires: challenge,
           MDNkeys: challenge.MDNlinks,
           MDNlinks: getMDNLinks(challenge.MDNlinks),
+
           // htmls specific
-          environment: utils.whichEnvironment()
+          environment: utils.whichEnvironment(),
+
+          verb: utils.randomVerb(),
+          phrase: utils.randomPhrase(),
+          compliment: utils.randomCompliment()
         });
       })
       .subscribe(
diff --git a/server/views/coursewares/showBonfire.jade b/server/views/coursewares/showBonfire.jade
index 7ca4a6c..07e8353 100644
--- a/server/views/coursewares/showBonfire.jade
+++ b/server/views/coursewares/showBonfire.jade
@@ -70,20 +70,6 @@ block content
                 br
                 #testSuite.negative-10
                 br
-                script(type="text/javascript").
-                    var tests = !{JSON.stringify(tests)};
-                    var challengeSeed = !{JSON.stringify(challengeSeed)};
-                    var challenge_Id = !{JSON.stringify(challengeId)};
-                    var challenge_Name = !{JSON.stringify(name)};
-                    var started = Math.floor(Date.now());
-                    var challengeType = !{JSON.stringify(challengeType)};
-                    var dashedName = !{JSON.stringify(dashedName)};
-                    var _ = R;
-                    var dashed = !{JSON.stringify(dashedName)};
-                    var username;
-                if (user)
-                    script(type="text/javascript").
-                        username = !{JSON.stringify(user.username)};
 
         .col-md-8.col-lg-9
             .editorScrollDiv(style = "overflow-y: auto; overflow-x: hidden;")
@@ -91,7 +77,7 @@ block content
                     form.code
                         .form-group.codeMirrorView
                             textarea#codeEditor(autofocus=true, style='display: none;')
-                    script(src=rev('/js', 'commonFramework.js'))
+
 
     #complete-courseware-dialog.modal(tabindex='-1')
         .modal-dialog.animated.fadeIn.fast-animation
@@ -125,15 +111,32 @@ block content
                     a.btn.btn-lg.btn-info.btn-block#reset-button(href='#', data-dismiss='modal', aria-hidden='true') Clear my code
                     a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
     include ../partials/challenge-modals
-    script.
+    script(type="text/javascript").
+      var common = window.common = { init: [] };
+
+      common.tests = !{JSON.stringify(tests)};
+      common.head = !{JSON.stringify(head)};
+      common.tail = !{JSON.stringify(tail)};
 
+      common.challengeId = !{JSON.stringify(challengeId)};
+      common.challengeName = !{JSON.stringify(name)};
+      common.challengeSeed = !{JSON.stringify(challengeSeed)};
+      common.challengeType = !{JSON.stringify(challengeType)};
+      common.dashedName = !{JSON.stringify(dashedName)};
+
+      common.started = Math.floor(Date.now());
+      if (user) {
+        common.username = !{JSON.stringify(user.username)};
+      }
+
+    include ../partials/challenge-footer
+    script.
       document.addEventListener('gitter-sidecar-ready', function(e) {
         if (window.main) {
           window.main.chat.createHelpChat('freecodecamp/helpbonfires', '#challenge-help-btn', 'Bonfires Help');
         }
       });
 
-      var MDNlinks = !{JSON.stringify(MDNlinks)};
-      if (!MDNlinks.length) {
+      if (!{JSON.stringify(MDNlinks.length)}) {
           $('#MDN-links').addClass('collapse');
       }
diff --git a/server/views/coursewares/showHTML.jade b/server/views/coursewares/showHTML.jade
index d07dd77..698918c 100644
--- a/server/views/coursewares/showHTML.jade
+++ b/server/views/coursewares/showHTML.jade
@@ -58,26 +58,12 @@ block content
                     .button-spacer
                     #testSuite
                     br
-                    script(type="text/javascript").
-                        $('#next-courseware-button').attr('disabled', 'disabled');
-                        var tests = !{JSON.stringify(tests)};
-                        var challengeSeed = !{JSON.stringify(challengeSeed)};
-                        var challenge_Id = !{JSON.stringify(challengeId)};
-                        var challenge_Name = !{JSON.stringify(name)};
-                        var prodOrDev = !{JSON.stringify(environment)};
-                        var dashedName = !{JSON.stringify(dashedName)};
-                        var challengeType = !{JSON.stringify(challengeType)};
-                        var started = Math.floor(Date.now());
         .col-md-5.col-lg-6
             .editorScrollDiv(style = "overflow-y: auto; overflow-x: hidden;")
                     #mainEditorPanel
                         form.code
                             .codeMirrorView
                                 textarea#codeEditor(autofocus=true, style='display: none;')
-                                script(src=rev('/js', 'commonFramework.js'))
-                                script.
-                                    editor.setOption('lint', false);
-                                    editor.setOption("mode", "text/html");
         .col-md-4.col-lg-3
             .hidden-xs.hidden-sm
                 img.iphone-position.iframe-scroll(src="https://s3.amazonaws.com/freecodecamp/iphone6-frame.png", style = "z-index: -2;")
@@ -100,9 +86,30 @@ block content
                             else
                                 #next-challenge.btn.btn-lg.btn-primary.btn-block Go to my next challenge (ctrl + enter)
     include ../partials/challenge-modals
+    script(type="text/javascript").
+      $('#next-courseware-button').attr('disabled', 'disabled');
+      var common = window.common || { init: [] };
+
+      common.tests = !{JSON.stringify(tests)};
+      common.head = !{JSON.stringify(head)};
+      common.tail = !{JSON.stringify(tail)};
+
+      common.challengeId = !{JSON.stringify(challengeId)};
+      common.challengeName = !{JSON.stringify(name)};
+      common.challengeSeed = !{JSON.stringify(challengeSeed)};
+      common.challengeType = !{JSON.stringify(challengeType)};
+      common.dashedName = !{JSON.stringify(dashedName)};
+
+      common.prodOrDev = !{JSON.stringify(environment)};
+      common.started = Math.floor(Date.now());
+
+    include ../partials/challenge-footer
     script.
       document.addEventListener('gitter-sidecar-ready', function(e) {
         if (window.main) {
           window.main.chat.createHelpChat('freecodecamp/help', '#challenge-help-btn');
         }
       });
+
+      editor.setOption('lint', false);
+      editor.setOption("mode", "text/html");
diff --git a/server/views/coursewares/showJS.jade b/server/views/coursewares/showJS.jade
index 4cfe47b..18e7166 100644
--- a/server/views/coursewares/showJS.jade
+++ b/server/views/coursewares/showJS.jade
@@ -61,25 +61,12 @@ block content
                     br
                     #testSuite.negative-10
                     br
-                    script(type="text/javascript").
-                        var tests = !{JSON.stringify(tests)};
-                        var challengeSeed = !{JSON.stringify(challengeSeed)};
-                        var challenge_Id = !{JSON.stringify(challengeId)};
-                        var challenge_Name = !{JSON.stringify(name)};
-                        var dashedName = !{JSON.stringify(dashedName)};
-                        var started = Math.floor(Date.now());
-                        var challengeType = !{JSON.stringify(challengeType)};
-                        var _ = R;
-                        var dashed = !{JSON.stringify(dashedName)};
         .col-md-8.col-lg-9
             .editorScrollDiv(style = "overflow-y: auto; overflow-x: hidden;")
                 #mainEditorPanel
                     form.code
                         .codeMirrorView
                             textarea#codeEditor(autofocus=true, style='display: none;')
-                            script(src=rev('/js', 'commonFramework.js'))
-                            script.
-                                editor.setOption("mode", "javascript");
     #complete-courseware-dialog.modal(tabindex='-1')
         .modal-dialog.animated.fadeIn.fast-animation
             .modal-content
@@ -97,9 +84,24 @@ block content
                         else
                             #next-challenge.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Go to my next challenge (ctrl + enter)
     include ../partials/challenge-modals
+    script(type="text/javascript").
+      var common = window.common = { init: [] };
+
+      common.tests = !{JSON.stringify(tests)};
+      common.head = !{JSON.stringify(head)};
+      common.tail = !{JSON.stringify(tail)};
+
+      common.challengeId = !{JSON.stringify(challengeId)};
+      common.challengeName = !{JSON.stringify(name)};
+      common.challengeSeed = !{JSON.stringify(challengeSeed)};
+      common.challengeType = !{JSON.stringify(challengeType)};
+      common.dashedName = !{JSON.stringify(dashedName)};
+
+      common.started = Math.floor(Date.now());
+
+    include ../partials/challenge-footer
     script.
-      var MDNlinks = !{JSON.stringify(MDNlinks)};
-      if (!MDNlinks.length) {
+      if (!{JSON.stringify(MDNlinks.length)}) {
           $('#MDN-links').addClass('collapse');
       }
       document.addEventListener('gitter-sidecar-ready', function(e) {
@@ -107,3 +109,4 @@ block content
           window.main.chat.createHelpChat('freecodecamp/help', '#challenge-help-btn');
         }
       });
+      editor.setOption("mode", "javascript");
diff --git a/server/views/coursewares/showStep.jade b/server/views/coursewares/showStep.jade
index b87811c..8b9fd2d 100644
--- a/server/views/coursewares/showStep.jade
+++ b/server/views/coursewares/showStep.jade
@@ -34,9 +34,9 @@ block content
                           #challenge-step-btn-submit.animated.fadeIn.btn.btn-lg.btn-primary.btn-block Submit and go to my next challenge
                       else
                           a.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) Go to my next challenge
-    script(src=rev('/js', 'commonFramework.js'))
     script.
       var common = window.common || { init: [] };
+
       common.challengeId = !{JSON.stringify(challengeId)};
       common.challengeName = !{JSON.stringify(name)};
       common.challengeType = 7;
@@ -45,3 +45,4 @@ block content
       common.isFrontEndCert = !{JSON.stringify(isFrontEndCert || false)};
       common.isFullStackCert = !{JSON.stringify(isFullStackCert || false)};
       common.challengeSeed = !{JSON.stringify(challengeSeed || [])};
+    script(src=rev('/js', 'commonFramework.js'))
diff --git a/server/views/coursewares/showVideo.jade b/server/views/coursewares/showVideo.jade
index b73ace7..8f95c5c 100644
--- a/server/views/coursewares/showVideo.jade
+++ b/server/views/coursewares/showVideo.jade
@@ -75,14 +75,19 @@ block content
                             a.animated.fadeIn.btn.btn-lg.btn-primary.btn-block(href='/challenges/next-challenge?id=' + challengeId) I've completed this challenge (ctrl + enter)
         script.
             $('body').bind('keydown', controlEnterHandler);
+
+    include ../partials/challenge-modals
     script.
-      var challenge_Id = !{JSON.stringify(challengeId)};
-      var challenge_Name = !{JSON.stringify(name)};
-      var challengeType = !{JSON.stringify(challengeType)};
-      var dashedName = !{JSON.stringify(dashedName)};
+      var common = window.common = { init: [] };
+
+      common.challengeId = !{JSON.stringify(challengeId)};
+      common.challengeName = !{JSON.stringify(name)};
+      common.challengeType = !{JSON.stringify(challengeType)};
+      common.dashedName = !{JSON.stringify(dashedName)};
+
       document.addEventListener('gitter-sidecar-ready', function(e) {
         if (window.main) {
           window.main.chat.createHelpChat('freecodecamp/help', '#challenge-help-btn');
         }
       });
-    include ../partials/challenge-modals
+    include ../partials/challenge-footer
diff --git a/server/views/partials/challenge-footer.jade b/server/views/partials/challenge-footer.jade
new file mode 100644
index 0000000..3f76382
--- /dev/null
+++ b/server/views/partials/challenge-footer.jade
@@ -0,0 +1,5 @@
+script(src=rev('/js', 'commonFramework.js'))
+script.
+  if (typeof localStorage !== 'undefined') {
+    localStorage.setItem('currentDashedName', typeof common !== 'undefined' && common.dashedName || '');
+  }
diff --git a/server/views/partials/challenge-modals.jade b/server/views/partials/challenge-modals.jade
index 7510fbee..128be1c 100644
--- a/server/views/partials/challenge-modals.jade
+++ b/server/views/partials/challenge-modals.jade
@@ -19,7 +19,3 @@
                 h3 This will restore your code editor to its original state.
                 a.btn.btn-lg.btn-info.btn-block#reset-button(href='#', data-dismiss='modal', aria-hidden='true') Clear my code
                 a.btn.btn-lg.btn-primary.btn-block(href='#', data-dismiss='modal', aria-hidden='true') Cancel
-script.
-  if (typeof localStorage !== 'undefined') {
-    localStorage.setItem('currentDashedName', typeof common !== 'undefined' && common.dashedName || dashedName || '');
-  }
diff --git a/server/views/partials/scripts.jade b/server/views/partials/scripts.jade
index c88702d..60ed1f1 100644
--- a/server/views/partials/scripts.jade
+++ b/server/views/partials/scripts.jade
@@ -35,5 +35,4 @@ script.
 // Leave the below lines alone!
 script(src=rev('/js', 'main.js'))
 script(src="/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js")
-script(src="/bower_components/ramda/dist/ramda.min.js")
 script(src='/bower_components/lightbox2/dist/js/lightbox.min.js')
diff --git a/server/views/stories/hot-stories.jade b/server/views/stories/hot-stories.jade
index 9d512f8..0666058 100644
--- a/server/views/stories/hot-stories.jade
+++ b/server/views/stories/hot-stories.jade
@@ -1,10 +1,7 @@
 .spacer
 .spacer
 #story-list.story-list
-
-    script(src="https://cdn.jsdelivr.net/ramda/0.10.0/ramda.min.js")
     script.
-
         var getLinkedName = function getLinkedName(name) {
             return name.trim().toLowerCase().replace(/\s/g, '-');
         }
diff --git a/server/views/stories/submit-story.jade b/server/views/stories/submit-story.jade
index 21baa0a..114c607 100644
--- a/server/views/stories/submit-story.jade
+++ b/server/views/stories/submit-story.jade
@@ -1,10 +1,12 @@
 .spacer
 .col-xs-12
     script.
-        var storyURL = !{JSON.stringify(storyURL)};
-        var storyTitle = !{JSON.stringify(storyTitle)};
-        var storyImage = !{JSON.stringify(storyImage)};
-        var storyMetaDescription = !{JSON.stringify(storyMetaDescription)};
+      var main = window.main || { init: [] };
+      main.storyURL = !{JSON.stringify(storyURL)};
+      main.storyTitle = !{JSON.stringify(storyTitle)};
+      main.storyImage = !{JSON.stringify(storyImage)};
+      main.storyMetaDescription = !{JSON.stringify(storyMetaDescription)};
+
     form.form-horizontal.control-label-story-submission#story-submission-form(name="submitStory")
         .col-xs-12
             .form-group
