'use-strict';
/**
 * AWS Module: Action: Modularized Code
 */
 var threescale = require('awsm-3scale').authenticate;

// Export For Lambda Handler
module.exports.run = function(event, context, cb) {
  return cb(null, action(event, context));
};

function getMethodName(path, method) {
    if (!path || !method) return 'hits';
    var pathFrag = path.replace(/^\/|\/$/g, '').replace(/\//g, '_');
    return pathFrag + '_' + method;
};

var action = function(event, context) {
	var method = getMethodName(event.resourcePath, event.httpMethod);
	if (event.user_key) {
    threescale.authenticate(event.user_key, method, function(err, res) {
      if (err) {
          context.fail(err);
      } else {
          context.succeed(true);
      }
    });
	} else {
	  context.fail('user_key missing');
	}
};

@@ -243,520 +243,190 @@
 %7D;%0A%0A
-function getMethodName(path, method) %7B%0A    if (!path %7C%7C !method) return 'hits';%0A    var pathFrag = path.replace(/%5E%5C/%7C%5C/$/g, '').replace(/%5C//g, '_');%0A    return pathFrag + '_' + method;%0A%7D;%0A%0Avar action = function(event, context) %7B%0A%09var method = getMethodName(event.resourcePath, event.httpMethod);%0A%09if (event.user_key) %7B%0A    threescale.authenticate(event.user_key, method, function(err, res) %7B%0A      if (err) %7B%0A          context.fail(err);%0A      %7D else %7B%0A          context.succeed(true);%0A      %7D
+var action = function(event, context) %7B%0A  if (threescale.authenticate(event.user_key)) %7B%0A      context.succeed(%7B%22question%22: pickAQuestion(), %22answer%22: pickAnAnswer()%7D);
 %0A    %7D
-);%0A%09%7D
  else %7B%0A
 %09  c
@@ -421,17 +421,20 @@
  else %7B%0A
-%09
+    
   contex
@@ -445,29 +445,33 @@
 il('
-user_key missing');%0A%09
+403, unauthorized');%0A    
 %7D%0A%7D;

Fix index.js structure