Use Javascript Module Pattern in main.js, fix #7