implemented shutdown