define(function (require, exports, module) {
  var moment = require("moment");
  var underscore = require("underscore");
  
  var _timedEvents = [];
  var _events = [];
  var _submitEventsImmediately = true;
  var _regardURL = "http://api.withregard.io/track/v1/WithRegard/Test/event";
  var _sessionId = "cdaa91fc-9c94-4826-9f2a-177be440f1ff";
  var _userId = "F16CB994-00FF-4326-B0DB-F316F7EC2942";
  
  var _initialTime = moment();
  
  var _timedEvent = function(eventName, funcToTime){
    var begin = moment();
    funcToTime();
    var end = moment();
    
    _timedEvents.push({
      name : eventName,
      startTime : begin.valueOf(),
      endTime : end.valueOf(),
      duration: end.diff(begin)
    });
  };
  
  var _postEvent = function(event){
    
    event["session-id"] = _sessionId;
    event["user-id"] = _userId;
    
    var postEventRequest = new XMLHttpRequest();
    postEventRequest.open("POST", _regardURL, true);
    postEventRequest.send(JSON.stringify(event));
  };
   
  var _trackEvent = function(eventName, props){
    var event = { 
      name: eventName,
    };           
    
    _.extend(event, props);
    
    if(_submitEventsImmediately){
      _postEvent(event);
    }
    else{
      _events.push(event);
    }
  }
    
  exports.initialTime = _initialTime;
  exports.trackTimedEvent = _timedEvent;
  exports.timedEvents = _timedEvents;
  exports.events = _events;
  exports.trackEvent = _trackEvent;
});
@@ -113,24 +113,254 @@
 score%22);%0A  %0A
+  var _createGuid = function()%7B%0A    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/%5Bxy%5D/g, function(c) %7B%0A        var r = Math.random()*16%7C0, v = c === 'x' ? r : (r&0x3%7C0x8);%0A        return v.toString(16);%0A    %7D);%0A  %7D;%0A   %0A
   var _timed
@@ -368,24 +368,24 @@
 vents = %5B%5D;%0A
-
   var _event
@@ -532,104 +532,53 @@
 d = 
-%22cdaa91fc-9c94-4826-9f2a-177be440f1ff%22;%0A  var _userId = %22F16CB994-00FF-4326-B0DB-F316F7EC2942%22;%0A
+_createGuid();%0A  var _userId = _createGuid();
   %0A 
@@ -607,19 +607,20 @@
 ment();%0A
-
   %0A
+%0A
   var _t
@@ -1620,11 +1620,232 @@
 kEvent;%0A
+  exports.newSession = function() %7B %0A    _sessionId = _createGuid(); %0A    return _sessionId;%0A  %7D;%0A  exports.setRegardURL = function(url)%7B _regardURL = url; %7D;%0A  exports.setUserId = function(userId) %7B _userId = userId; %7D;%0A
 %7D);

add some setters and a createGuid function