Added shutdown functionality.