Separated app code into app.js