adding graceful shutdown