Added shutdown functionality