Added shutdown function.