Copied main.js from backbone version.