Added MIT license.  Code cleanup in main.js