big error code renumber to support classification of recoverable errors and thus skip over errors when searching maps
diff --git a/example.c b/example.c
index f855194..1e25efa 100644
--- a/example.c
+++ b/example.c
@@ -398,20 +398,20 @@
  @param[in] uQCBORType The expected type or @c QCBOR_TYPE_ANY
  @param[in] pItem  The item to check.
 
- @retval QCBOR_ERR_NOT_FOUND  The label doesn't match.
+ @retval QCBOR_ERR_LABEL_NOT_FOUND  The label doesn't match.
  @retval QCBOR_ERR_UNEXPECTED_TYPE The label matches, but the type is not as expected.
  @retval QCBOR_SUCCESS Both label and type match.
  */
 QCBORError CheckLabelAndType(const char *szLabel, uint8_t uQCBORType, const QCBORItem *pItem)
 {
     if(pItem->uLabelType != QCBOR_TYPE_TEXT_STRING) {
-        return QCBOR_ERR_NOT_FOUND;
+        return QCBOR_ERR_LABEL_NOT_FOUND;
     }
 
     UsefulBufC Label = UsefulBuf_FromSZ(szLabel);
 
     if(UsefulBuf_Compare(Label, pItem->label.string)) {
-        return QCBOR_ERR_NOT_FOUND;
+        return QCBOR_ERR_LABEL_NOT_FOUND;
     }
 
     if(pItem->uDataType != uQCBORType && uQCBORType != QCBOR_TYPE_ANY) {
@@ -525,7 +525,7 @@
         if(uErr == QCBOR_SUCCESS) {
             pE->Manufacturer = Item.val.string;
             continue;
-        } else if(uErr != QCBOR_ERR_NOT_FOUND){
+        } else if(uErr != QCBOR_ERR_LABEL_NOT_FOUND){
             /* Maunfacturer field missing or badly formed */
             return EngineProtocolerror;
         } /* continue on and try for another match */
@@ -538,7 +538,7 @@
                 pE->uNumCylinders = (uint8_t)Item.val.int64;
                 continue;
             }
-        } else if(uErr != QCBOR_ERR_NOT_FOUND){
+        } else if(uErr != QCBOR_ERR_LABEL_NOT_FOUND){
             /* NumCylinders field missing or badly formed */
             return EngineProtocolerror;
         } /* continue on and try for another match */
@@ -547,7 +547,7 @@
         if(uErr == QCBOR_SUCCESS) {
             DecodeCylinders(&DecodeCtx, pE, &Item);
             continue;
-        } else if(uErr != QCBOR_ERR_NOT_FOUND){
+        } else if(uErr != QCBOR_ERR_LABEL_NOT_FOUND){
             return EngineProtocolerror;
         }
 
@@ -555,7 +555,7 @@
         if(uErr == QCBOR_SUCCESS) {
             pE->uDisplacement = Item.val.int64;
             continue;
-        } else if(uErr != QCBOR_ERR_NOT_FOUND){
+        } else if(uErr != QCBOR_ERR_LABEL_NOT_FOUND){
             return EngineProtocolerror;
         }
 
@@ -563,7 +563,7 @@
         if(uErr == QCBOR_SUCCESS) {
             pE->uHorsePower = Item.val.int64;
             continue;
-        } else if(uErr != QCBOR_ERR_NOT_FOUND){
+        } else if(uErr != QCBOR_ERR_LABEL_NOT_FOUND){
             return EngineProtocolerror;
         }
 
@@ -571,7 +571,7 @@
         if(uErr == QCBOR_SUCCESS) {
             pE->dDesignedCompresion = Item.val.dfnum;
             continue;
-        } else if(uErr != QCBOR_ERR_NOT_FOUND){
+        } else if(uErr != QCBOR_ERR_LABEL_NOT_FOUND){
             return EngineProtocolerror;
         }
 
@@ -585,7 +585,7 @@
                 return EngineProtocolerror;
             }
             continue;
-        } else if(uErr != QCBOR_ERR_NOT_FOUND){
+        } else if(uErr != QCBOR_ERR_LABEL_NOT_FOUND){
             return EngineProtocolerror;
         }
 
diff --git a/inc/qcbor/qcbor_common.h b/inc/qcbor/qcbor_common.h
index aaa46a1..400f023 100644
--- a/inc/qcbor/qcbor_common.h
+++ b/inc/qcbor/qcbor_common.h
@@ -36,6 +36,8 @@
 
 
 /**
+ @file qcbor_common.h
+
  This define indicates a version of QCBOR that supports spiffy decode,
  the decode functions found in qcbor_spiffy_decode.h.
 
@@ -224,183 +226,251 @@
 
 /**
  Error codes returned by QCBOR Encoder and Decoder.
+ Encode errors are 1..8
+ Decode errors are 9..43
+     Not well-formed errors are 9..16
+     Unrecoverable decode errors are 15..24
+        (partial overlap with not well-formed errors)
+   Other decode errors are 25..43
+
+ The errors are order and grouped intentionally to keep the code size
+ of QCBORDecode_IsNotWellFormedError() and
+ QCBORDecode_IsUnrecoverableError() minimal. Error renumbering may
+ occur in the future when new error codes are added for new QCBOR
+ features.
  */
 typedef enum {
    /** The encode or decode completely correctly. */
    QCBOR_SUCCESS = 0,
 
-#define QCBOR_ERR_FIRST_NOT_WELL_FORMED  1 /* QCBOR_ERR_BAD_TYPE_7 */
+    /** The buffer provided for the encoded output when doing encoding
+        was too small and the encoded output will not fit. */
+    QCBOR_ERR_BUFFER_TOO_SMALL = 1,
+   
+    /** During encoding, an attempt to create simple value between 24
+        and 31. */
+    QCBOR_ERR_ENCODE_UNSUPPORTED = 2,
 
-   /** During decoding, the CBOR is not valid, primarily a simple type
-       is encoded in a prohibited way. */
-   QCBOR_ERR_BAD_TYPE_7 = 1,
-
-
-   /** Returned by QCBORDecode_Finish() if all the inputs bytes have
-       not been consumed. */
-   QCBOR_ERR_EXTRA_BYTES = 2,
-
-   /** One of the chunks in an indefinite-length string is not of the
-       type of the start of the string. */
-   QCBOR_ERR_INDEFINITE_STRING_CHUNK = 3,
-
-   /** During decoding, a break occurred outside an indefinite-length
-       item. */
-   QCBOR_ERR_BAD_BREAK = 4,
-
-   /** During decoding, some CBOR construct was encountered that this
-       decoder doesn't support, primarily this is the reserved
-       additional info values, 28 through 30. During encoding, an
-       attempt to create simple value between 24 and 31. */
-   QCBOR_ERR_UNSUPPORTED = 5,
-
-   /** During decoding, hit the end of the given data to decode. For
-       example, a byte string of 100 bytes was expected, but the end
-       of the input was hit before finding those 100 bytes.  Corrupted
-       CBOR input will often result in this error. See also @ref
-       QCBOR_ERR_NO_MORE_ITEMS.
+    /** During encoding, the length of the encoded CBOR exceeded @c
+        UINT32_MAX.
      */
-   QCBOR_ERR_HIT_END = 6,
+    QCBOR_ERR_BUFFER_TOO_LARGE = 3,
 
-   /** During encoding or decoding, the number of array or map opens
-       was not matched by the number of closes. */
-   QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN = 7,
+    /** During encoding, the array or map nesting was deeper than this
+        implementation can handle. Note that in the interest of code
+        size and memory use, this implementation has a hard limit on
+        array nesting. The limit is defined as the constant @ref
+        QCBOR_MAX_ARRAY_NESTING. */
+    QCBOR_ERR_ARRAY_NESTING_TOO_DEEP = 4,
 
-   /** An integer type is encoded with a bad length (an indefinite length) */
-   QCBOR_ERR_BAD_INT = 8,
+    /** During encoding, @c QCBOREncode_CloseXxx() called with a
+        different type than is currently open.  */
+    QCBOR_ERR_CLOSE_MISMATCH = 5,
 
-#define QCBOR_ERR_LAST_NOT_WELL_FORMED QCBOR_ERR_BAD_INT
-
-   /** During decoding, the label for a map entry is bad. What causes
-       this error depends on the decoding mode. */
-   QCBOR_ERR_MAP_LABEL_TYPE = 9,
-
-   /** During encoding, the length of the encoded CBOR exceeded @c
-       UINT32_MAX. */
-   QCBOR_ERR_BUFFER_TOO_LARGE = 10,
-
-   /** During decoding, a date greater than +- 292 billion years from
-       Jan 1 1970 encountered during parsing. */
-   QCBOR_ERR_DATE_OVERFLOW = 11,
-
-   /** The buffer provided for the encoded output when doing encoding
-       was too small and the encoded output will not fit. Also, when
-       the buffer given to QCBORDecode_SetMemPool() is too small. */
-   QCBOR_ERR_BUFFER_TOO_SMALL = 12,
-
-   /** Optional tagging that doesn't make sense (an integer is tagged
-       as a date string) or can't be handled. */
-   QCBOR_ERR_BAD_OPT_TAG = 13,
-
-   /** During encoding or decoding, the array or map nesting was
-       deeper than this implementation can handle. Note that in the
-       interest of code size and memory use, this implementation has a
-       hard limit on array nesting. The limit is defined as the
-       constant @ref QCBOR_MAX_ARRAY_NESTING. */
-   QCBOR_ERR_ARRAY_NESTING_TOO_DEEP = 14,
-
-   /** During encoding, @c QCBOREncode_CloseXxx() called with a
-       different type than is currently open. Also during decoding,
-       @c QCBORDecode_ExitXxx() was called for a different
-       type than @c QCBORDecode_EnterXxx(). */
-   QCBOR_ERR_CLOSE_MISMATCH = 15,
-
-   /** Unable to decode an indefinite-length string because no string
-       allocator was configured. See QCBORDecode_SetMemPool() or
-       QCBORDecode_SetUpAllocator(). */
-   QCBOR_ERR_NO_STRING_ALLOCATOR = 16,
-
-    /** During decoding or encoding, the array or map had too many
-        items in it.  This limit @ref QCBOR_MAX_ITEMS_IN_ARRAY,
-        typically 65,535. */
-    QCBOR_ERR_ARRAY_TOO_LONG = 17,
-
-   /** Error allocating space for a string, usually for an
-       indefinite-length string. */
-   QCBOR_ERR_STRING_ALLOCATE = 18,
+    /** During encoding, the array or map had too many items in it.
+        This limit @ref QCBOR_MAX_ITEMS_IN_ARRAY, typically 65,535. */
+    QCBOR_ERR_ARRAY_TOO_LONG = 6,
 
     /** During encoding, more arrays or maps were closed than
         opened. This is a coding error on the part of the caller of
         the encoder. */
-    QCBOR_ERR_TOO_MANY_CLOSES = 19,
+    QCBOR_ERR_TOO_MANY_CLOSES = 7,
 
-   /** More than @ref QCBOR_MAX_TAGS_PER_ITEM tags encounterd for a
-       CBOR ITEM.  @ref QCBOR_MAX_TAGS_PER_ITEM is a limit of this
-       implementation.  During decoding, too many tags in the
-       caller-configured tag list, or not enough space in @ref
-       QCBORTagListOut. */
-   QCBOR_ERR_TOO_MANY_TAGS = 20,
+    /** During encoding the number of array or map opens was not
+        matched by the number of closes. */
+    QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN = 8,
+
+#define QCBOR_START_OF_NOT_WELL_FORMED_ERRORS 9
+
+   /** During decoding, the CBOR is not well-formed because a simple
+       value between 0 and 31 is encoded in a two-byte integer rather
+       than one. */
+   QCBOR_ERR_BAD_TYPE_7 = 9,
+
+   /** During decoding, returned by QCBORDecode_Finish() if all the
+       inputs bytes have not been consumed. This is considered not
+       well-formed. */
+   QCBOR_ERR_EXTRA_BYTES = 10,
+
+   /** During decoding, some CBOR construct was encountered that this
+       decoder doesn't support, primarily this is the reserved
+       additional info values, 28 through 30. The CBOR is not
+       well-formed.*/
+   QCBOR_ERR_UNSUPPORTED = 11,
+
+    /** During decoding, the an array or map was not fully consumed.
+        Returned by QCBORDecode_Finish(). The CBOR is not
+        well-formed. */
+    QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED = 12,
+
+   /** During decoding, an integer type is encoded with a bad length (
+       that of an indefinite length string). The CBOR is not-well
+       formed. */
+   QCBOR_ERR_BAD_INT = 13,
+
+    /** During decoding, one of the chunks in an indefinite-length
+        string is not of the type of the start of the string.  The
+        CBOR is not well-formed.  This error makes no further decoding
+        possible. */
+    QCBOR_ERR_INDEFINITE_STRING_CHUNK = 14,
+
+#define QCBOR_START_OF_UNRECOVERABLE_DECODE_ERRORS 15
+    /** During decoding, hit the end of the given data to decode. For
+        example, a byte string of 100 bytes was expected, but the end
+        of the input was hit before finding those 100 bytes.
+        Corrupted CBOR input will often result in this error. See also
+        @ref QCBOR_ERR_NO_MORE_ITEMS. The CBOR is not well-formed.
+        This error makes no further decoding possible.
+      */
+    QCBOR_ERR_HIT_END = 15,
+
+    /** During decoding, a break occurred outside an indefinite-length
+        item. The CBOR is not well-formed. This error makes no further
+        decoding possible. */
+    QCBOR_ERR_BAD_BREAK = 16,
+
+#define QCBOR_END_OF_NOT_WELL_FORMED_ERRORS 16
+
+    /**
+        During decoding, the input is too large. It is greater than
+     UINT32_MAX - 1. This is an implementation limit. This error makes no further decoding possible.
+     */
+    QCBOR_ERR_INPUT_TOO_LARGE = 17,
+
+    /** During decoding, the array or map nesting was deeper than this
+        implementation can handle. Note that in the interest of code
+        size and memory use, this implementation has a hard limit on
+        array nesting. The limit is defined as the constant @ref
+        QCBOR_MAX_ARRAY_NESTING. This error makes no further decoding
+        possible. */
+    QCBOR_ERR_ARRAY_DECODE_NESTING_TOO_DEEP = 18,
+
+    /** During decoding, the array or map had too many items in it.
+        This limit @ref QCBOR_MAX_ITEMS_IN_ARRAY, typically 65,534,
+        UINT16_MAX - 1. This error makes no further decoding
+        possible. */
+    QCBOR_ERR_ARRAY_DECODE_TOO_LONG = 19,
+
+    /** More than @ref QCBOR_MAX_TAGS_PER_ITEM tags encounterd for a
+        CBOR ITEM.  @ref QCBOR_MAX_TAGS_PER_ITEM is a limit of this
+        implementation.  During decoding, too many tags in the
+        caller-configured tag list, or not enough space in @ref
+        QCBORTagListOut. This error makes no further decoding
+        possible.  */
+    QCBOR_ERR_TOO_MANY_TAGS = 20,
+
+    /** When decoding, a string's size is greater than what a size_t
+        can hold less 4. In all but some very strange situations this
+        is because of corrupt input CBOR and should be treated as
+        such. The strange situation is a CPU with a very small size_t
+        (e.g., a 16-bit CPU) and a large string (e.g., > 65KB). This
+        error makes no further decoding possible.
+     */
+    QCBOR_ERR_STRING_TOO_LONG = 21,
+
+    /** Something is wrong with a decimal fraction or bigfloat such as
+        it not consisting of an array with two integers. This error
+        makes no further decoding possible. */
+    QCBOR_ERR_BAD_EXP_AND_MANTISSA = 22,
+
+    /** Unable to decode an indefinite-length string because no string
+        allocator was configured. See QCBORDecode_SetMemPool() or
+        QCBORDecode_SetUpAllocator().  This error makes no further
+        decoding possible.*/
+    QCBOR_ERR_NO_STRING_ALLOCATOR = 23,
+
+    /** Error allocating space for a string, usually for an
+        indefinite-length string. This error makes no further decoding
+        possible. */
+    QCBOR_ERR_STRING_ALLOCATE = 24,
+
+#define QCBOR_END_OF_UNRECOVERABLE_DECODE_ERRORS 24
+
+    /** During decoding, the type of the label for a map entry is not
+        one that can be handled in the current decoding
+        mode. Typically this is because a label is not an intger or a
+        string. This is an implemation limit. */
+    QCBOR_ERR_MAP_LABEL_TYPE = 25,
+
+    /** When decodeing for a specific type, the type was not was
+        expected.  */
+    QCBOR_ERR_UNEXPECTED_TYPE = 26,
+
+    /** This occurs when decoding one of the tags that QCBOR
+        processed internally.  The content of a tag was of the wrong
+        type. (They were known as "Optional Tags" in RFC 7049. */
+     QCBOR_ERR_BAD_OPT_TAG = 27,
+
+    /** Duplicate label in map detected */
+    QCBOR_ERR_DUPLICATE_LABEL = 28,
+
+    /** During decoding, the buffer given to QCBORDecode_SetMemPool()
+        is either too small, smaller than
+        QCBOR_DECODE_MIN_MEM_POOL_SIZE or too large, larger than
+        UINT32_MAX.
+        */
+    QCBOR_ERR_MEM_POOL_SIZE = 29,
 
     /** During decoding, an integer smaller than INT64_MIN was
         received (CBOR can represent integers smaller than INT64_MIN,
         but C cannot). */
-   QCBOR_ERR_INT_OVERFLOW = 21,
+    QCBOR_ERR_INT_OVERFLOW = 30,
 
-   /** All well-formed data items have been consumed and there are no
-       more. If parsing a CBOR stream this indicates the non-error end
-       of the stream. If parsing a CBOR stream / sequence, this
-       probably indicates that some data items expected are not
-       present.  See also @ref QCBOR_ERR_HIT_END. */
-   QCBOR_ERR_NO_MORE_ITEMS = 22,
+    /** During decoding, a date greater than +- 292 billion years from
+        Jan 1 1970 encountered during parsing. This is an implementation limit. */
+    QCBOR_ERR_DATE_OVERFLOW = 31,
 
-   /** Something is wrong with a decimal fraction or bigfloat such as
-       it not consisting of an array with two integers */
-   QCBOR_ERR_BAD_EXP_AND_MANTISSA = 23,
+    /** During decoding, @c QCBORDecode_ExitXxx() was called for a
+        different type than @c QCBORDecode_EnterXxx(). */
+    QCBOR_ERR_EXIT_MISMATCH = 32,
 
-   /** When decoding, a string's size is greater than size_t. In all
-       but some very strange situations this is because of corrupt
-       input CBOR and should be treated as such. The strange situation
-       is a CPU with a very small size_t (e.g., a 16-bit CPU) and a
-       large string (e.g., > 65KB).
-    */
-   QCBOR_ERR_STRING_TOO_LONG = 24,
+    /** All well-formed data items have been consumed and there are no
+        more. If parsing a CBOR stream this indicates the non-error end
+        of the stream. If parsing a CBOR stream / sequence, this
+        probably indicates that some data items expected are not
+        present.  See also @ref QCBOR_ERR_HIT_END. */
+   QCBOR_ERR_NO_MORE_ITEMS = 33,
 
-   /** When decodeing for a specific type, the type was not was
-       expected.  See also @ref QCBOR_ERR_UNEXPECTED_TYPE
-       which in many cases is effectively the same error */
-   QCBOR_ERR_UNEXPECTED_TYPE = 25,
-
-   /** Duplicate label in map detected */
-   QCBOR_ERR_DUPLICATE_LABEL = 26,
-
-   /** Item with requested label is not found */
-   QCBOR_ERR_NOT_FOUND = 27,
+   /** When finding an item by lable, an item with the requested label
+       was not found. */
+   QCBOR_ERR_LABEL_NOT_FOUND = 34,
 
    /** Number conversion failed because of sign. For example a
        negative int64_t can't be converted to a uint64_t */
-   QCBOR_ERR_NUMBER_SIGN_CONVERSION = 28,
+   QCBOR_ERR_NUMBER_SIGN_CONVERSION = 35,
 
    /** When converting a decoded number, the value is too large or to
        small for the conversion target */
-   QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW = 30,
+   QCBOR_ERR_CONVERSION_UNDER_OVER_FLOW = 36,
 
    /** Trying to get an item by label when a map has not been entered. */
-   QCBOR_ERR_MAP_NOT_ENTERED = 31,
+   QCBOR_ERR_MAP_NOT_ENTERED = 37,
 
    /** A callback indicates processing should not continue for some
        non-CBOR reason */
-   QCBOR_ERR_CALLBACK_FAIL = 32,
+   QCBOR_ERR_CALLBACK_FAIL = 38,
 
    /** Trying to get something by label when not entered into a
        map.  */
-   QCBOR_ERR_NOT_A_MAP = 33,
+   QCBOR_ERR_NOT_A_MAP = 39,
 
    /** Decoding of floating-point epoch dates is unsupported and a
-        floating-point date was encountered by the decoder. */
-   QCBOR_ERR_FLOAT_DATE_DISABLED = 34,
+       floating-point date was encountered by the decoder. */
+   QCBOR_ERR_FLOAT_DATE_DISABLED = 40,
 
    /** Support for half-precision float decoding is disabled. */
-   QCBOR_ERR_HALF_PRECISION_DISABLED = 35,
+   QCBOR_ERR_HALF_PRECISION_DISABLED = 41,
 
-   /** Use of floating-point HW is disabled. This affects all type conversions
-        to and from double and float types. */
-   QCBOR_ERR_HW_FLOAT_DISABLED = 36,
+   /** Use of floating-point HW is disabled. This affects all type
+       conversions to and from double and float types. */
+   QCBOR_ERR_HW_FLOAT_DISABLED = 42,
 
-    /** Unable to complete operation because a floating-point value that
-     is a NaN (not a number), that is too large, too small,
-     infinity or -infinity was encountered in encoded CBOR. Usually
-     this because conversion of the float-point value was being attempted. */
-    QCBOR_ERR_FLOAT_EXCEPTION = 37,
+   /** Unable to complete operation because a floating-point value
+       that is a NaN (not a number), that is too large, too small,
+       infinity or -infinity was encountered in encoded CBOR. Usually
+       this because conversion of the float-point value was being
+       attempted. */
+    QCBOR_ERR_FLOAT_EXCEPTION = 43,
 
    /* This is stored in uint8_t; never add values > 255 */
 } QCBORError;
@@ -414,7 +484,7 @@
 /**
  The maximum nesting of arrays and maps when encoding or decoding. The
  error @ref QCBOR_ERR_ARRAY_NESTING_TOO_DEEP will be returned on
- encoding of decoding if it is exceeded.
+ encoding or QCBOR_ERR_ARRAY_DECODE_NESTING_TOO_DEEP on decoding if it is exceeded.
  */
 #define QCBOR_MAX_ARRAY_NESTING  QCBOR_MAX_ARRAY_NESTING1
 
diff --git a/inc/qcbor/qcbor_decode.h b/inc/qcbor/qcbor_decode.h
index 6982e54..5c72fac 100644
--- a/inc/qcbor/qcbor_decode.h
+++ b/inc/qcbor/qcbor_decode.h
@@ -721,7 +721,7 @@
 
  @retval QCBOR_ERR_BAD_OPT_TAG     Invalid CBOR, tag on wrong type.
 
- @retval QCBOR_ERR_ARRAY_TOO_LONG  Implementation limit, array or map
+ @retval QCBOR_ERR_ARRAY_DECODE_TOO_LONG  Implementation limit, array or map
                                    too long.
 
  @retval QCBOR_ERR_INT_OVERFLOW    Implementation limit, negative
@@ -730,7 +730,7 @@
  @retval QCBOR_ERR_DATE_OVERFLOW   Implementation limit, date larger
                                    than can be handled.
 
- @retval QCBOR_ERR_ARRAY_NESTING_TOO_DEEP  Implementation limit, nesting
+ @retval QCBOR_ERR_ARRAY_DECODE_NESTING_TOO_DEEP  Implementation limit, nesting
                                            too deep.
 
  @retval QCBOR_ERR_STRING_ALLOCATE Resource exhaustion, string allocator
@@ -1095,7 +1095,24 @@
  @param[in] uErr    The decoder context.
  @return @c true if the error code indicates non-well-formed CBOR.
  */
-static bool QCBORDecode_IsNotWellFormed(QCBORError uErr);
+static bool QCBORDecode_IsNotWellFormedError(QCBORError uErr);
+
+
+/**
+ @brief Whether a decoding error is recoverable.
+
+ @param[in] uErr    The decoder context.
+ @return @c true if the error code indicates and uncrecoverable error.
+
+ When an error is unrecoverable, no further decoding of the input is possible.
+ CBOR is a compact format with almost no redundancy so errors like
+ incorrect lengths or array counts are unrecoverable. Unrecoverable
+ errors also occur when certain implementation limits such as the
+ limit on array and map nesting occur.
+ */
+static bool QCBORDecode_IsUnrecoverableError(QCBORError uErr);
+
+
 
 
 /**
@@ -1226,16 +1243,25 @@
     return uReturn;
 }
 
-static inline bool QCBORDecode_IsNotWellFormed(QCBORError uErr)
+static inline bool QCBORDecode_IsNotWellFormedError(QCBORError uErr)
 {
-   if(uErr >= QCBOR_ERR_FIRST_NOT_WELL_FORMED &&
-      uErr <= QCBOR_ERR_LAST_NOT_WELL_FORMED) {
+   if(uErr >= QCBOR_START_OF_NOT_WELL_FORMED_ERRORS &&
+      uErr <= QCBOR_END_OF_NOT_WELL_FORMED_ERRORS) {
       return true;
    } else {
       return false;
    }
 }
 
+static inline bool QCBORDecode_IsUnrecoverableError(QCBORError uErr)
+{
+   if(uErr >= QCBOR_START_OF_UNRECOVERABLE_DECODE_ERRORS &&
+      uErr <= QCBOR_END_OF_UNRECOVERABLE_DECODE_ERRORS) {
+      return true;
+   } else {
+      return false;
+   }
+}
 
 #ifdef __cplusplus
 }
diff --git a/src/qcbor_decode.c b/src/qcbor_decode.c
index a3edc6a..0a9906e 100644
--- a/src/qcbor_decode.c
+++ b/src/qcbor_decode.c
@@ -48,6 +48,7 @@
  */
 #define UNCONST_POINTER(ptr)    ((void *)(ptr))
 
+#define SIZEOF_C_ARRAY(array,type) (sizeof(array)/sizeof(type))
 
 
 inline static bool
@@ -305,7 +306,7 @@
 {
    // Error out if nesting is too deep
    if(pNesting->pCurrent >= &(pNesting->pLevels[QCBOR_MAX_ARRAY_NESTING])) {
-      return QCBOR_ERR_ARRAY_NESTING_TOO_DEEP;
+      return QCBOR_ERR_ARRAY_DECODE_NESTING_TOO_DEEP;
    }
 
    // The actual descend
@@ -327,7 +328,7 @@
     just to mark it in bounded mode.
     */
    if(uOffset >= QCBOR_NON_BOUNDED_OFFSET) {
-      return QCBOR_ERR_BUFFER_TOO_LARGE;
+      return QCBOR_ERR_INPUT_TOO_LARGE;
    }
 
    pNesting->pCurrentBounded = pNesting->pCurrent;
@@ -355,7 +356,7 @@
    // Error out if arrays is too long to handle
    if(uCount != QCBOR_COUNT_INDICATES_INDEFINITE_LENGTH &&
       uCount > QCBOR_MAX_ITEMS_IN_ARRAY) {
-      uError = QCBOR_ERR_ARRAY_TOO_LONG;
+      uError = QCBOR_ERR_ARRAY_DECODE_TOO_LONG;
       goto Done;
    }
 
@@ -630,7 +631,7 @@
  This decodes the fundamental part of a CBOR data item, the type and
  number
 
- This is the Counterpart to InsertEncodedTypeAndNumber().
+ This is the counterpart to QCBOREncode_EncodeHead().
 
  This does the network->host byte order conversion. The conversion
  here also results in the conversion for floats in addition to that
@@ -802,16 +803,16 @@
 {
    QCBORError nReturn = QCBOR_SUCCESS;
 
-   // uAdditionalInfo is 5 bits from the initial byte compile time checks
+   // uAdditionalInfo is 5 bits from the initial byte. Compile time checks
    // above make sure uAdditionalInfo values line up with uDataType values.
-   // DecodeTypeAndNumber never returns a major type > 1f so cast is safe
+   // DecodeTypeAndNumber() never returns an AdditionalInfo > 0x1f so cast is safe
    pDecodedItem->uDataType = (uint8_t)nAdditionalInfo;
 
    switch(nAdditionalInfo) {
       // No check for ADDINFO_RESERVED1 - ADDINFO_RESERVED3 as they are
       // caught before this is called.
 
-      case HALF_PREC_FLOAT:
+      case HALF_PREC_FLOAT: // 25
 #ifndef QCBOR_DISABLE_PREFERRED_FLOAT
          // Half-precision is returned as a double.
          // The cast to uint16_t is safe because the encoded value
@@ -822,7 +823,7 @@
          nReturn = QCBOR_ERR_HALF_PRECISION_DISABLED;
 #endif
          break;
-      case SINGLE_PREC_FLOAT:
+      case SINGLE_PREC_FLOAT: // 26
          // Single precision is normally returned as a double
          // since double is widely supported, there is no loss of
          // precision, it makes it easy for the caller in
@@ -850,7 +851,7 @@
          }
          break;
 
-      case DOUBLE_PREC_FLOAT:
+      case DOUBLE_PREC_FLOAT: // 27
          pDecodedItem->val.dfnum = UsefulBufUtil_CopyUint64ToDouble(uNumber);
          pDecodedItem->uDataType = QCBOR_TYPE_DOUBLE;
          break;
@@ -1038,7 +1039,7 @@
       case CBOR_MAJOR_TYPE_MAP:   // Major type 5
          // Record the number of items in the array or map
          if(uNumber > QCBOR_MAX_ITEMS_IN_ARRAY) {
-            nReturn = QCBOR_ERR_ARRAY_TOO_LONG;
+            nReturn = QCBOR_ERR_ARRAY_DECODE_TOO_LONG;
             goto Done;
          }
          if(nAdditionalInfo == LEN_IS_INDEFINITE) {
@@ -1335,7 +1336,7 @@
 
  @retval QCBOR_ERR_MAP_LABEL_TYPE
 
- @retval QCBOR_ERR_ARRAY_TOO_LONG
+ @retval QCBOR_ERR_ARRAY_DECODE_TOO_LONG
  */
 static inline QCBORError
 GetNext_MapEntry(QCBORDecodeContext *me, QCBORItem *pDecodedItem)
@@ -1394,7 +1395,7 @@
    } else {
       if(pDecodedItem->uDataType == QCBOR_TYPE_MAP) {
          if(pDecodedItem->val.uCount > QCBOR_MAX_ITEMS_IN_ARRAY/2) {
-            nReturn = QCBOR_ERR_ARRAY_TOO_LONG;
+            nReturn = QCBOR_ERR_ARRAY_DECODE_TOO_LONG;
             goto Done;
          }
          // Decoding a map as an array
@@ -1538,7 +1539,7 @@
 
  @retval QCBOR_ERR_MAP_LABEL_TYPE X
 
- @retval QCBOR_ERR_ARRAY_TOO_LONG
+ @retval QCBOR_ERR_ARRAY_DECODE_TOO_LONG
 
  @retval QCBOR_ERR_NO_MORE_ITEMS
 
@@ -1577,7 +1578,8 @@
 
    /* ==== Next: not at the end so get another item ==== */
    uReturn = GetNext_MapEntry(me, pDecodedItem);
-   if(uReturn) {
+   if(QCBORDecode_IsUnrecoverableError(uReturn)) {
+      /* Error is so bad that traversal is not possible. */
       goto Done;
    }
 
@@ -1611,10 +1613,14 @@
        processed, not when they are opened with the exception of an
        empty map or array.
        */
-      uReturn = DecodeNesting_DescendMapOrArray(&(me->nesting),
+      QCBORError uDescendErr;
+      uDescendErr = DecodeNesting_DescendMapOrArray(&(me->nesting),
                                                 pDecodedItem->uDataType,
                                                 pDecodedItem->val.uCount);
-      if(uReturn != QCBOR_SUCCESS) {
+      if(uDescendErr != QCBOR_SUCCESS) {
+         /* This error is probably a traversal error and it
+          overrides the non-traversal error. */
+         uReturn = uDescendErr;
          goto Done;
       }
    }
@@ -1633,8 +1639,12 @@
        length map/array. If the end of the map/array was reached, then
        it ascends nesting levels, possibly all the way to the top level.
        */
-      uReturn = NestLevelAscender(me, true);
-      if(uReturn) {
+      QCBORError uAscendErr;
+      uAscendErr = NestLevelAscender(me, true);
+      if(uAscendErr != QCBOR_SUCCESS) {
+         /* This error is probably a traversal error and it
+          overrides the non-traversal error. */
+         uReturn = uAscendErr;
          goto Done;
       }
    }
@@ -1656,7 +1666,9 @@
 Done:
    if(uReturn != QCBOR_SUCCESS) {
       /* This sets uDataType and uLabelType to QCBOR_TYPE_NONE */
-      memset(pDecodedItem, 0, sizeof(QCBORItem));
+      pDecodedItem->uDataType = QCBOR_TYPE_NONE;
+      pDecodedItem->uLabelType = QCBOR_TYPE_NONE;
+      // memset(pDecodedItem, 0, sizeof(QCBORItem));
    }
    return uReturn;
 }
@@ -2210,7 +2222,7 @@
 
    // Error out if all the maps/arrays are not closed out
    if(!DecodeNesting_IsCurrentAtTop(&(me->nesting))) {
-      uReturn = QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN;
+      uReturn = QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED;
       goto Done;
    }
 
@@ -2272,10 +2284,10 @@
    string and an epoch date QCBOR_ERR_UNSUPPORTED
 
  - Encontered an array or mapp that has too many items
-   QCBOR_ERR_ARRAY_TOO_LONG
+   QCBOR_ERR_ARRAY_DECODE_TOO_LONG
 
  - Encountered array/map nesting that is too deep
-   QCBOR_ERR_ARRAY_NESTING_TOO_DEEP
+   QCBOR_ERR_ARRAY_DECODE_NESTING_TOO_DEEP
 
  - An epoch date > INT64_MAX or < INT64_MIN was encountered
    QCBOR_ERR_DATE_OVERFLOW
@@ -2448,19 +2460,19 @@
    // constant in the header is correct.  This check should optimize
    // down to nothing.
    if(QCBOR_DECODE_MIN_MEM_POOL_SIZE < 2 * sizeof(uint32_t)) {
-      return QCBOR_ERR_BUFFER_TOO_SMALL;
+      return QCBOR_ERR_MEM_POOL_SIZE;
    }
 
    // The pool size and free offset packed in to the beginning of pool
    // memory are only 32-bits. This check will optimize out on 32-bit
    // machines.
    if(Pool.len > UINT32_MAX) {
-      return QCBOR_ERR_BUFFER_TOO_LARGE;
+      return QCBOR_ERR_MEM_POOL_SIZE;
    }
 
    // This checks that the pool buffer given is big enough.
    if(MemPool_Pack(Pool, QCBOR_DECODE_MIN_MEM_POOL_SIZE)) {
-      return QCBOR_ERR_BUFFER_TOO_SMALL;
+      return QCBOR_ERR_MEM_POOL_SIZE;
    }
 
    pMe->StringAllocator.pfAllocator    = MemPool_Function;
@@ -2503,8 +2515,7 @@
        */
       do {
          uReturn = QCBORDecode_GetNext(pMe, &Item);
-         if(QCBORDecode_IsNotWellFormed(uReturn)) {
-            // TODO: also resource limit errors
+         if(QCBORDecode_IsUnrecoverableError(uReturn)) {
             goto Done;
          }
       } while(Item.uNextNestLevel >= pItemToConsume->uNextNestLevel);
@@ -2602,6 +2613,8 @@
 
  If an item was not found, its data type is set to QCBOR_TYPE_NONE.
  */
+// TODO: make this handle indefinite length strings, possibly with
+// allocation only when returning the string.
 static QCBORError
 MapSearch(QCBORDecodeContext *pMe,
           QCBORItem          *pItemArray,
@@ -2661,15 +2674,14 @@
       /* Get the item */
       QCBORItem Item;
       uReturn = QCBORDecode_GetNext(pMe, &Item);
-      if(QCBORDecode_IsNotWellFormed(uReturn)) {
+      if(QCBORDecode_IsUnrecoverableError(uReturn)) {
          /* Got non-well-formed CBOR so map can't even be decoded. */
-         // TODO: also bail out on implementation limits like array too big
          goto Done;
       }
-       if(uReturn == QCBOR_ERR_NO_MORE_ITEMS) {
-           // Unexpected end of map or array.
-           goto Done;
-       }
+      if(uReturn == QCBOR_ERR_NO_MORE_ITEMS) {
+         // Unexpected end of map or array.
+         goto Done;
+      }
 
       /* See if item has one of the labels that are of interest */
       bool bMatched = false;
@@ -2770,7 +2782,7 @@
       goto Done;
    }
    if(OneItemSeach[0].uDataType == QCBOR_TYPE_NONE) {
-      uReturn = QCBOR_ERR_NOT_FOUND;
+      uReturn = QCBOR_ERR_LABEL_NOT_FOUND;
       goto Done;
    }
 
@@ -2804,7 +2816,7 @@
       goto Done;
    }
    if(OneItemSeach[0].uDataType == QCBOR_TYPE_NONE) {
-      uReturn = QCBOR_ERR_NOT_FOUND;
+      uReturn = QCBOR_ERR_LABEL_NOT_FOUND;
       goto Done;
    }
 
@@ -2970,7 +2982,7 @@
    }
 
    if(pSearch->uDataType == QCBOR_TYPE_NONE) {
-      pMe->uLastError = QCBOR_ERR_NOT_FOUND;
+      pMe->uLastError = QCBOR_ERR_LABEL_NOT_FOUND;
       return;
    }
 
@@ -3170,7 +3182,7 @@
    QCBORError uErr;
 
    if(!DecodeNesting_IsBoundedType(&(pMe->nesting), uType)) {
-      uErr = QCBOR_ERR_CLOSE_MISMATCH;
+      uErr = QCBOR_ERR_EXIT_MISMATCH;
       goto Done;
    }
 
@@ -3248,7 +3260,7 @@
    const size_t uEndOfBstr = UsefulInputBuf_Tell(&(pMe->InBuf));
    if(uEndOfBstr >= UINT32_MAX || uPreviousLength >= UINT32_MAX) {
       // TODO: test this error condition
-      uError = QCBOR_ERR_BUFFER_TOO_LARGE;
+      uError = QCBOR_ERR_INPUT_TOO_LARGE;
       goto Done;
    }
    UsefulInputBuf_Seek(&(pMe->InBuf), uEndOfBstr - pItem->val.string.len);
@@ -3332,7 +3344,7 @@
    }
 
    if(!DecodeNesting_IsBoundedType(&(pMe->nesting), QCBOR_TYPE_BYTE_STRING)) {
-      pMe->uLastError = QCBOR_ERR_CLOSE_MISMATCH;
+      pMe->uLastError = QCBOR_ERR_EXIT_MISMATCH;
       return;
    }
 
diff --git a/src/qcbor_encode.c b/src/qcbor_encode.c
index 08de596..a53f775 100644
--- a/src/qcbor_encode.c
+++ b/src/qcbor_encode.c
@@ -203,7 +203,7 @@
    QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN -- Finish called without enough closes
 
  Would generate not-well-formed CBOR
-   QCBOR_ERR_UNSUPPORTED             -- Simple type between 24 and 31
+   QCBOR_ERR_ENCODE_UNSUPPORTED      -- Simple type between 24 and 31
  */
 
 
@@ -565,7 +565,7 @@
 {
    if(me->uError == QCBOR_SUCCESS) {
       if(uNum >= CBOR_SIMPLEV_RESERVED_START && uNum <= CBOR_SIMPLEV_RESERVED_END) {
-         me->uError = QCBOR_ERR_UNSUPPORTED;
+         me->uError = QCBOR_ERR_ENCODE_UNSUPPORTED;
       } else {
          // AppendHead() does endian swapping for the float / double
          AppendCBORHead(me, CBOR_MAJOR_TYPE_SIMPLE, uNum, uMinLen);
diff --git a/test/qcbor_decode_tests.c b/test/qcbor_decode_tests.c
index d046244..26ed048 100644
--- a/test/qcbor_decode_tests.c
+++ b/test/qcbor_decode_tests.c
@@ -908,7 +908,7 @@
       }
    }
 
-   if(QCBORDecode_GetNext(&DCtx, &Item) != QCBOR_ERR_ARRAY_NESTING_TOO_DEEP)
+   if(QCBORDecode_GetNext(&DCtx, &Item) != QCBOR_ERR_ARRAY_DECODE_NESTING_TOO_DEEP)
       nReturn = -1;
 
    return(nReturn);
@@ -1306,7 +1306,7 @@
                     UsefulBuf_FROM_BYTE_ARRAY_LITERAL(pTooLargeMap),
                     QCBOR_DECODE_MODE_MAP_AS_ARRAY);
 
-   if((QCBOR_ERR_ARRAY_TOO_LONG != QCBORDecode_GetNext(&DCtx, &Item))) {
+   if((QCBOR_ERR_ARRAY_DECODE_TOO_LONG != QCBORDecode_GetNext(&DCtx, &Item))) {
       return -50;
    }
 
@@ -1350,11 +1350,11 @@
    }
    if(Item.uDataType != QCBOR_TYPE_MAP ||
       Item.val.uCount != 3)
-      return -1;
+      return -2;
 
    if(nLevel < 2) {
-      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
-         return -1;
+      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
+         return -3;
       } else {
          return 0;
       }
@@ -1368,12 +1368,12 @@
       Item.uDataType != QCBOR_TYPE_INT64 ||
       Item.val.uCount != 42 ||
       UsefulBufCompareToSZ(Item.label.string, "first integer")) {
-      return -1;
+      return -4;
    }
 
    if(nLevel < 3) {
-      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
-         return -1;
+      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
+         return -5;
       } else {
          return 0;
       }
@@ -1386,13 +1386,13 @@
       UsefulBufCompareToSZ(Item.label.string, "an array of two strings") ||
       Item.uDataType != QCBOR_TYPE_ARRAY ||
       Item.val.uCount != 2) {
-      return -1;
+      return -6;
    }
 
 
    if(nLevel < 4) {
-      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
-         return -1;
+      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
+         return -7;
       } else {
          return 0;
       }
@@ -1404,12 +1404,12 @@
    }
    if(Item.uDataType != QCBOR_TYPE_TEXT_STRING ||
       UsefulBufCompareToSZ(Item.val.string, "string1")) {
-      return -1;
+      return -8;
    }
 
    if(nLevel < 5) {
-      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
-         return -1;
+      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
+         return -9;
       } else {
          return 0;
       }
@@ -1420,12 +1420,12 @@
    }
    if(Item.uDataType != QCBOR_TYPE_TEXT_STRING ||
       UsefulBufCompareToSZ(Item.val.string, "string2")) {
-      return -1;
+      return -10;
    }
 
    if(nLevel < 6) {
-      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
-         return -1;
+      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
+         return -11;
       } else {
          return 0;
       }
@@ -1438,11 +1438,11 @@
       UsefulBufCompareToSZ(Item.label.string, "map in a map") ||
       Item.uDataType != QCBOR_TYPE_MAP ||
       Item.val.uCount != 4)
-      return -1;
+      return -12;
 
    if(nLevel < 7) {
-      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
-         return -1;
+      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
+         return -13;
       } else {
          return 0;
       }
@@ -1455,12 +1455,12 @@
       UsefulBufCompareToSZ(Item.label.string, "bytes 1") ||
       Item.uDataType != QCBOR_TYPE_BYTE_STRING ||
       UsefulBufCompareToSZ(Item.val.string, "xxxx")) {
-      return -1;
+      return -14;
    }
 
    if(nLevel < 8) {
-      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
-         return -1;
+      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
+         return -15;
       } else {
          return 0;
       }
@@ -1473,12 +1473,12 @@
       UsefulBufCompareToSZ(Item.label.string, "bytes 2") ||
       Item.uDataType != QCBOR_TYPE_BYTE_STRING ||
       UsefulBufCompareToSZ(Item.val.string, "yyyy")) {
-      return -1;
+      return -16;
    }
 
    if(nLevel < 9) {
-      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
-         return -1;
+      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
+         return -17;
       } else {
          return 0;
       }
@@ -1491,11 +1491,11 @@
       UsefulBufCompareToSZ(Item.label.string, "another int") ||
       Item.uDataType != QCBOR_TYPE_INT64 ||
       Item.val.int64 != 98)
-      return -1;
+      return -18;
 
    if(nLevel < 10) {
-      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
-         return -1;
+      if(QCBORDecode_Finish(&DCtx) != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
+         return -19;
       } else {
          return 0;
       }
@@ -1508,11 +1508,11 @@
       UsefulBuf_Compare(Item.label.string, UsefulBuf_FromSZ("text 2"))||
       Item.uDataType != QCBOR_TYPE_TEXT_STRING ||
       UsefulBufCompareToSZ(Item.val.string, "lies, damn lies and statistics")) {
-      return -1;
+      return -20;
    }
 
    if(QCBORDecode_Finish(&DCtx)) {
-      return -1;
+      return -21;
    }
 
    return 0;
@@ -1657,7 +1657,7 @@
       // Every test vector must fail with
       // a not-well-formed error. If not
       // this test fails.
-      if(!QCBORDecode_IsNotWellFormed(uCBORError) &&
+      if(!QCBORDecode_IsNotWellFormedError(uCBORError) &&
          uCBORError != QCBOR_ERR_NO_MORE_ITEMS) {
          // Return index of failure in the error code
          return 2000 + nIterate;
@@ -2481,7 +2481,7 @@
    }
 #else /* QCBOR_DISABLE_FLOAT_HW_USE */
    uError = QCBORDecode_GetAndResetError(&DC);
-   if(uError != QCBOR_ERR_NOT_FOUND) {
+   if(uError != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 102;
    }
 #endif /* QCBOR_DISABLE_FLOAT_HW_USE */
@@ -2495,7 +2495,7 @@
    }
 #else /* QCBOR_DISABLE_FLOAT_HW_USE */
    uError = QCBORDecode_GetAndResetError(&DC);
-   if(uError != QCBOR_ERR_NOT_FOUND) {
+   if(uError != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 112;
    }
 #endif /* QCBOR_DISABLE_FLOAT_HW_USE */
@@ -2514,7 +2514,6 @@
    }
 #endif /* QCBOR_DISABLE_FLOAT_HW_USE */
 
-#if 1
    // A half-precision date with value -2 FFF
    QCBORDecode_GetEpochDateInMapN(&DC, 9, QCBOR_TAG_REQUIREMENT_OPTIONAL_TAG,
                                   &nEpochDate4);
@@ -2528,16 +2527,14 @@
       return 106;
    }
 #endif /* QCBOR_DISABLE_FLOAT_HW_USE */
-#else
-   (void)nEpochDate4;
-#endif
+
 
    // Fail to get an epoch date by string label
    QCBORDecode_GetEpochDateInMapSZ(&DC, "no-label",
                                    QCBOR_TAG_REQUIREMENT_NOT_A_TAG,
                                    &nEpochDate6);
    uError = QCBORDecode_GetAndResetError(&DC);
-   if(uError != QCBOR_ERR_NOT_FOUND) {
+   if(uError != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 107;
    }
 
@@ -2545,7 +2542,7 @@
    QCBORDecode_GetEpochDateInMapN(&DC, 99999, QCBOR_TAG_REQUIREMENT_NOT_A_TAG,
                                   &nEpochDate6);
    uError = QCBORDecode_GetAndResetError(&DC);
-   if(uError != QCBOR_ERR_NOT_FOUND) {
+   if(uError != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 108;
    }
 
@@ -2554,7 +2551,7 @@
                                     QCBOR_TAG_REQUIREMENT_NOT_A_TAG,
                                     &StringDate1);
    uError = QCBORDecode_GetAndResetError(&DC);
-   if(uError != QCBOR_ERR_NOT_FOUND) {
+   if(uError != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 109;
    }
 
@@ -2562,11 +2559,12 @@
    QCBORDecode_GetDateStringInMapN(&DC, 99999, QCBOR_TAG_REQUIREMENT_NOT_A_TAG,
                                    &StringDate1);
    uError = QCBORDecode_GetAndResetError(&DC);
-   if(uError != QCBOR_ERR_NOT_FOUND) {
+   if(uError != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 110;
    }
 
    // The rest of these succeed even if float features are disabled
+
    // Epoch date 1400000000; Tue, 13 May 2014 16:53:20 GMT
    QCBORDecode_GetEpochDateInMapN(&DC,
                                   1,
@@ -3553,7 +3551,7 @@
       QCBORError nReturn = QCBORDecode_GetNext(&DC, &Item);
       if(j >= QCBOR_MAX_ARRAY_NESTING) {
          // Should be in error
-         if(nReturn != QCBOR_ERR_ARRAY_NESTING_TOO_DEEP) {
+         if(nReturn != QCBOR_ERR_ARRAY_DECODE_NESTING_TOO_DEEP) {
             return -4;
          } else {
             return 0; // Decoding doesn't recover after an error
@@ -3671,7 +3669,7 @@
    }
 
    nResult = QCBORDecode_Finish(&DC);
-   if(nResult != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
+   if(nResult != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
       return -8;
    }
 
@@ -3699,7 +3697,7 @@
    }
 
    nResult = QCBORDecode_Finish(&DC);
-   if(nResult != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
+   if(nResult != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
       return -12;
    }
 
@@ -3745,7 +3743,7 @@
    }
 
    nResult = QCBORDecode_Finish(&DC);
-   if(nResult != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
+   if(nResult != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
       return -17;
    }
 
@@ -4931,7 +4929,7 @@
    // This will fail because the map is empty.
    QCBORDecode_GetInt64InMapSZ(&DCtx, "another int",  &nDecodedInt2);
    uErr = QCBORDecode_GetAndResetError(&DCtx);
-   if(uErr != QCBOR_ERR_NOT_FOUND){
+   if(uErr != QCBOR_ERR_LABEL_NOT_FOUND){
       return 2010;
    }
    QCBORDecode_ExitMap(&DCtx);
@@ -4946,7 +4944,7 @@
    // This will fail because the map is empty.
    QCBORDecode_GetInt64InMapSZ(&DCtx, "another int",  &nDecodedInt2);
    uErr = QCBORDecode_GetAndResetError(&DCtx);
-   if(uErr != QCBOR_ERR_NOT_FOUND){
+   if(uErr != QCBOR_ERR_LABEL_NOT_FOUND){
       return 2012;
    }
    QCBORDecode_ExitMap(&DCtx);
@@ -5656,7 +5654,7 @@
    // Try to finish before consuming all bytes to confirm
    // that the still-open error is returned.
    uCBORError = QCBORDecode_Finish(&DCtx);
-   if(uCBORError != QCBOR_ERR_ARRAY_OR_MAP_STILL_OPEN) {
+   if(uCBORError != QCBOR_ERR_ARRAY_OR_MAP_UNCONSUMED) {
       return 11;
    }
 
@@ -6106,7 +6104,7 @@
       return 4;
    }
    QCBORDecode_GetDateStringInMapSZ(&DC, "xxx", QCBOR_TAG_REQUIREMENT_OPTIONAL_TAG, &String);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 5;
    }
 
@@ -6125,11 +6123,11 @@
       return 12;
    }
    QCBORDecode_GetBignumInMapN(&DC, 14, QCBOR_TAG_REQUIREMENT_NOT_A_TAG, &String, &bNeg);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 13;
    }
    QCBORDecode_GetBignumInMapSZ(&DC, "xxx", QCBOR_TAG_REQUIREMENT_NOT_A_TAG, &String, &bNeg);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 14;
    }
 
@@ -6142,11 +6140,11 @@
       return 21;
    }
    QCBORDecode_GetURIInMapN(&DC, 22, QCBOR_TAG_REQUIREMENT_TAG, &String);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 22;
    }
    QCBORDecode_GetURIInMapSZ(&DC, "xxx", QCBOR_TAG_REQUIREMENT_TAG, &String);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 23;
    }
 
@@ -6159,11 +6157,11 @@
       return 31;
    }
    QCBORDecode_GetB64InMapN(&DC, 32, QCBOR_TAG_REQUIREMENT_NOT_A_TAG, &String);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 32;
    }
    QCBORDecode_GetB64InMapSZ(&DC, "xxx", QCBOR_TAG_REQUIREMENT_NOT_A_TAG, &String);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 33;
    }
 
@@ -6176,11 +6174,11 @@
       return 41;
    }
    QCBORDecode_GetB64URLInMapN(&DC, 42, QCBOR_TAG_REQUIREMENT_NOT_A_TAG, &String);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 42;
    }
    QCBORDecode_GetB64URLInMapSZ(&DC, "xxx", QCBOR_TAG_REQUIREMENT_NOT_A_TAG, &String);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 43;
    }
 
@@ -6193,11 +6191,11 @@
       return 51;
    }
    QCBORDecode_GetRegexInMapN(&DC, 52, QCBOR_TAG_REQUIREMENT_TAG, &String);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 52;
    }
    QCBORDecode_GetRegexInMapSZ(&DC, "xxx", QCBOR_TAG_REQUIREMENT_TAG, &String);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 53;
    }
 
@@ -6224,11 +6222,11 @@
       return 63;
    }
    QCBORDecode_GetMIMEMessageInMapN(&DC, 64, QCBOR_TAG_REQUIREMENT_TAG, &String, &bNeg);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 64;
    }
    QCBORDecode_GetMIMEMessageInMapSZ(&DC, "zzz", QCBOR_TAG_REQUIREMENT_TAG, &String, &bNeg);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 65;
    }
 
@@ -6241,11 +6239,11 @@
       return 71;
    }
    QCBORDecode_GetBinaryUUIDInMapN(&DC, 72, QCBOR_TAG_REQUIREMENT_TAG, &String);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 72;
    }
    QCBORDecode_GetBinaryUUIDInMapSZ(&DC, "xxx", QCBOR_TAG_REQUIREMENT_TAG, &String);
-   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_NOT_FOUND) {
+   if(QCBORDecode_GetAndResetError(&DC) != QCBOR_ERR_LABEL_NOT_FOUND) {
       return 73;
    }
 
diff --git a/test/qcbor_encode_tests.c b/test/qcbor_encode_tests.c
index 2a5e5d9..c8c35c6 100644
--- a/test/qcbor_encode_tests.c
+++ b/test/qcbor_encode_tests.c
@@ -2486,14 +2486,14 @@
    QCBOREncode_Init(&EC, Large);
    QCBOREncode_OpenArray(&EC);
    QCBOREncode_AddSimple(&EC, 24); // CBOR_SIMPLEV_RESERVED_START
-   if(QCBOREncode_FinishGetSize(&EC, &xx) != QCBOR_ERR_UNSUPPORTED) {
+   if(QCBOREncode_FinishGetSize(&EC, &xx) != QCBOR_ERR_ENCODE_UNSUPPORTED) {
       return -12;
    }
 
    QCBOREncode_Init(&EC, Large);
    QCBOREncode_OpenArray(&EC);
    QCBOREncode_AddSimple(&EC, 31); // CBOR_SIMPLEV_RESERVED_END
-   if(QCBOREncode_FinishGetSize(&EC, &xx) != QCBOR_ERR_UNSUPPORTED) {
+   if(QCBOREncode_FinishGetSize(&EC, &xx) != QCBOR_ERR_ENCODE_UNSUPPORTED) {
       return -13;
    }