Moved shutdown hook