Added a clean shutdown