Added failed check / fixed logic of failures in app.js