move application code to app.js