Extracted most inline JS into an app.js. First step towards more modular JS code