Add Shutdown and fix exit