moved all the app logic into main.js