Added some shutdown code