Some modifications so the app can run multiple times