graceful shutdown; watch cmd change; refactors