Update app.js

Fixed problem with init order when scripts are required
Changed global storage from array to object