Shutdown functions amended