var IPHistoryData = (function() {
    function parse_ua(user_agent) {
        // Table of UA-values (and precedences) from:
        //  https://developer.mozilla.org/en-US/docs/Browser_detection_using_the_user_agent
        // Regexes stolen from:
        //  https://github.com/biggora/express-useragent/blob/master/lib/express-useragent.js
        var lookup = [
            {name: 'Edge',      regex: /Edge\/([\d\w\.\-]+)/i},
            {name: 'SeaMonkey', regex: /seamonkey\/([\d\w\.\-]+)/i},
            {name: 'Opera',     regex: /(?:opera|opr)\/([\d\w\.\-]+)/i},
            {name: 'Chromium',  regex: /(?:chromium|crios)\/([\d\w\.\-]+)/i},
            {name: 'Chrome',    regex: /chrome\/([\d\w\.\-]+)/i},
            {name: 'Safari',    regex: /version\/([\d\w\.\-]+)/i},
            {name: 'IE',        regex: /msie\s([\d\.]+[\d])/i},
            {name: 'IE',        regex: /trident\/\d+\.\d+;.*[rv:]+(\d+\.\d)/i},
            {name: 'Firefox',   regex: /firefox\/([\d\w\.\-]+)/i},
        ];
        var name = 'Unknown';
        var version = 'Unknown';
        for (var i = 0; i < lookup.length; i++) {
            var info = lookup[i];
            var match = user_agent.match(info.regex);
            if (match !== null) {
                name = info.name;
                version = match[1];
                break;
            }
        }
        return {
            name: name,
            version: version,
        };
    }

    function parse(activity) {
        console.log(activity);
        var environ    = activity.environment;
        var ip_addr    = environ.split(' ')[2].split('=')[1];
        var user_agent = environ.match('User_AGENT=(.+) LANG')[1];
        var browser    = parse_ua(user_agent);
        return {
            time:   activity.time,
            action: activity.action,
            success: activity.status === 1,
            browser: parse_ua(user_agent),
            ip_addr: ip_addr,
        };
    }

    return {
        parse: parse,
        parseUserAgent: parse_ua
    };
})();

@@ -1001,71 +1001,8 @@
  %5D;%0A
-        var name = 'Unknown';%0A        var version = 'Unknown';%0A
     
@@ -1165,24 +1165,53 @@
 !== null) %7B%0A
+                return %7B%0A    
             
@@ -1218,18 +1218,17 @@
     name
- =
+:
  info.na
@@ -1229,18 +1229,21 @@
 nfo.name
-;%0A
+,%0A   
         
@@ -1254,17 +1254,17 @@
     
+ 
 version
- =
+:
  mat
@@ -1268,17 +1268,17 @@
 match%5B1%5D
-;
+,
 %0A       
@@ -1290,13 +1290,9 @@
     
-break
+%7D
 ;%0A  
@@ -1332,73 +1332,12 @@
 urn 
-%7B%0A            name: name,%0A            version: version,%0A        %7D
+null
 ;%0A  

Return null when unable to parse