Add gracefully quit support