enclose use strict into function. remove plugins.js
custom event on {}. Misc refactoring