refactored app.js and master.js