Refactor app.js and remove some useless tests