Refactoring to use common app.js file