amended new code to connect_app.js