added conditional statements back and removed call to app.itialize