Added shutdown hook