Add working checkEnd function in app.js