got rid of loop for connecting to app, put listener as early as possible in code