Tried to make the app more rigid and crash&exit safe