diff --git a/content.js b/content.js
index f61a5bfb22734faad33ca1fdb933307a51e69331..2e17f1192add8832957581712d7acbcd5af7af16 100644
--- a/content.js
+++ b/content.js
@@ -17,7 +17,7 @@ var audioSample = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
 function parseCSS(cssObj) {
     var parser = new CSSParser();
     var sheet = parser.parse(cssObj, false, true);
-    var audioVars = ['loud', 'low', 'lomi', 'mid', 'mihi', 'hi', 'attack'];
+    var audioVars = ['loud', 'low', 'lomi', 'mid', 'mihi', 'hi', 'attack', 'onset'];
     var midiVars = ['cc', 'note'];
     chrome.runtime.sendMessage({ type: 'updateUi', data: true });
     sheet.cssRules.forEach(element => {
@@ -84,9 +84,9 @@ function templateToDict(string) {
             });
         }
         else {
-            if (string.includes(':')) {
-                eventType = string.split(':')[0];
-                eventName = string.split(':')[1];
+            if (template.includes(':')) {
+                eventType = template.split(':')[0];
+                eventName = template.split(':')[1];
             }
             else {
                 eventType = eventString;
@@ -102,6 +102,7 @@ function templateToDict(string) {
         }
         string = string.replace('[' + template + ']', '');
     }
+    console.log(returnValue);
     return returnValue;
 }
 
@@ -458,7 +459,7 @@ function audioEvent() {
                 volume = meter.volume * 1.4;
                 value = value.replace('[' + template['templateFull'] + ']', (meter.volume * 1.4 < 1 ? parseInt(template['min']) + Math.round((template['max'] - template['min']) * volume) : 0));
             }
-            if (template['eventType'] == 'note' && template['eventName'] == note) {
+            if (template['eventType'] == 'onset' && template['eventName'] == noteStrings[note % 12]) {
                 eventIn = true;
                 value = value.replace('[' + template['templateFull'] + ']', '');
             }
@@ -490,6 +491,7 @@ function onMessage({ type, data }) {
         case 'update': {
             const css = data.cssStr;
             audioEvents = [];
+            midiEvents = [];
             parseCSS(css)
             break;
         }