added shutdown functionality