restructured mozapp.js