Added some basic shutdown code