Handle the arguments better
Move initialization of the app to the event loop
Finally made the test app to exit properly with an according exit code