diff --git a/source/Lib/CommonLib/IntraPrediction.cpp b/source/Lib/CommonLib/IntraPrediction.cpp
index d15ead02820ef11175094240dd61c819a0967d69..96b2a27c7f4a81cbe234daba745409f142a6f463 100644
--- a/source/Lib/CommonLib/IntraPrediction.cpp
+++ b/source/Lib/CommonLib/IntraPrediction.cpp
@@ -1951,8 +1951,8 @@ bool IntraPrediction::calCopyRun(CodingStructure &cs, Partitioner& partitioner,
   run = 0;
   while (idx < total)
   {
-    xPos = m_puiScanOrder[idx].x;
-    yPos = m_puiScanOrder[idx].y;
+    xPos = m_scanOrder[idx].x;
+    yPos = m_scanOrder[idx].y;
     runType.at(xPos, yPos) = PLT_RUN_COPY;
 
     if (yPos == 0 && !cu.useRotation[compBegin])
@@ -1991,12 +1991,12 @@ bool IntraPrediction::calIndexRun(CodingStructure &cs, Partitioner& partitioner,
   uint32_t idx = startPos;
   while (idx < total)
   {
-    uint32_t xPos = m_puiScanOrder[idx].x;
-    uint32_t yPos = m_puiScanOrder[idx].y;
+    uint32_t xPos = m_scanOrder[idx].x;
+    uint32_t yPos = m_scanOrder[idx].y;
     runType.at(xPos, yPos) = PLT_RUN_INDEX;
 
-    uint32_t xPrev = idx == 0 ? 0 : m_puiScanOrder[idx - 1].x;
-    uint32_t yPrev = idx == 0 ? 0 : m_puiScanOrder[idx - 1].y;
+    uint32_t xPrev = idx == 0 ? 0 : m_scanOrder[idx - 1].x;
+    uint32_t yPrev = idx == 0 ? 0 : m_scanOrder[idx - 1].y;
     if (idx > startPos && curPLTIdx.at(xPos, yPos) == curPLTIdx.at(xPrev, yPrev))
     {
       run++;
diff --git a/source/Lib/CommonLib/IntraPrediction.h b/source/Lib/CommonLib/IntraPrediction.h
index d7e1978d7bb4e1cbda74fceab9cc3589d2457257..2d498e61c4ba44a87e1b63b0363756381b579657 100644
--- a/source/Lib/CommonLib/IntraPrediction.h
+++ b/source/Lib/CommonLib/IntraPrediction.h
@@ -116,11 +116,11 @@ protected:
   int m_topRefLength;
   int m_leftRefLength;
 #if JVET_O0119_BASE_PALETTE_444
-  ScanElement* m_puiScanOrder;
-  bool         m_bBestScanRotationMode;
-  Ctx          m_storeCtx_Run;
-  Ctx          m_storeCtx_RunIndex;
-  Ctx          m_storeCtx_RunCopy; 
+  ScanElement* m_scanOrder;
+  bool         m_bestScanRotationMode;
+  Ctx          m_storeCtxRun;
+  Ctx          m_storeCtxRunIndex;
+  Ctx          m_storeCtxRunCopy; 
   Ctx          m_orgCtxRD;
   bool         *m_runTypeRD;
   Pel          *m_runLengthRD;
diff --git a/source/Lib/CommonLib/LoopFilter.cpp b/source/Lib/CommonLib/LoopFilter.cpp
index 73973c7d674726f23a42a0a278462945a56a71fd..ddc2d56d1939e372a81c84affe81c3d2c6bc23b4 100644
--- a/source/Lib/CommonLib/LoopFilter.cpp
+++ b/source/Lib/CommonLib/LoopFilter.cpp
@@ -990,9 +990,9 @@ void LoopFilter::xEdgeFilterLuma( const CodingUnit& cu, const DeblockEdgeDir edg
 #if JVET_O0119_BASE_PALETTE_444
           if (spsPaletteEnabledFlag)
           {
-           // check if each of PUs is palette coded
-           bPartPNoFilter = bPartPNoFilter || CU::isPLT(cuP);
-           bPartQNoFilter = bPartQNoFilter || CU::isPLT(cuQ);
+            // check if each of PUs is palette coded
+            bPartPNoFilter = bPartPNoFilter || CU::isPLT(cuP);
+            bPartQNoFilter = bPartQNoFilter || CU::isPLT(cuQ);
           }
 #endif
 
diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp
index 11cfbf0a623446a4d22ecacd304c58f8050dc376..f36a0692a98f74013c8e870a53dc988647a330c4 100644
--- a/source/Lib/CommonLib/Rom.cpp
+++ b/source/Lib/CommonLib/Rom.cpp
@@ -128,6 +128,7 @@ public:
           m_line--;
         }
         break;
+
 #if JVET_O0119_BASE_PALETTE_444
       case SCAN_TRAV_HOR:
       {
@@ -808,8 +809,8 @@ bool g_isReusedUniMVsFilled[32][32][8][8];
 #endif
 
 #if JVET_O0119_BASE_PALETTE_444
-const uint8_t g_uhPLTQuant[52] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 22, 24, 23, 25, 26, 28, 29, 31, 32, 34, 36, 37, 39, 41, 42, 45 };
-uint8_t g_ucRunTopLut[5] = { 0, 1, 1, 2, 2 };
-uint8_t g_ucRunLeftLut[5] = { 0, 3, 3, 4, 4 };
+const uint8_t g_paletteQuant[52] = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 21, 22, 24, 23, 25, 26, 28, 29, 31, 32, 34, 36, 37, 39, 41, 42, 45 };
+uint8_t g_paletteRunTopLut [5] = { 0, 1, 1, 2, 2 };
+uint8_t g_paletteRunLeftLut[5] = { 0, 3, 3, 4, 4 };
 #endif
 //! \}
diff --git a/source/Lib/CommonLib/Rom.h b/source/Lib/CommonLib/Rom.h
index e22f65f1a297736253b37e45d8e3bb2e298e1b29..7303299f15115ebbb7c97a176abb8a42cecb153a 100644
--- a/source/Lib/CommonLib/Rom.h
+++ b/source/Lib/CommonLib/Rom.h
@@ -234,9 +234,9 @@ extern bool g_isReusedUniMVsFilled[32][32][8][8];
 #endif
 
 #if JVET_O0119_BASE_PALETTE_444
-extern const uint8_t g_uhPLTQuant[52];
-extern uint8_t g_ucRunTopLut[5];
-extern uint8_t g_ucRunLeftLut[5];
+extern const uint8_t g_paletteQuant[52];
+extern uint8_t g_paletteRunTopLut[5];
+extern uint8_t g_paletteRunLeftLut[5];
 #endif
 
 #endif  //__TCOMROM__
diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp
index 08bc9ad0ca34fc5a5db3531a02bd06e094085a81..da69dea0fe9928cadc1e72d317c7b278915bf909 100644
--- a/source/Lib/DecoderLib/CABACReader.cpp
+++ b/source/Lib/DecoderLib/CABACReader.cpp
@@ -1706,15 +1706,15 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_
   }
 
 
-  m_puiScanOrder = g_scanOrder[SCAN_UNGROUPED][(cu.useRotation[compBegin]) ? SCAN_TRAV_VER : SCAN_TRAV_HOR][gp_sizeIdxInfo->idxFrom(width)][gp_sizeIdxInfo->idxFrom(height)];
+  m_scanOrder = g_scanOrder[SCAN_UNGROUPED][(cu.useRotation[compBegin]) ? SCAN_TRAV_VER : SCAN_TRAV_HOR][gp_sizeIdxInfo->idxFrom(width)][gp_sizeIdxInfo->idxFrom(height)];
   uint32_t strPos = 0;
   uint32_t endPos = height * width;
   while (strPos < endPos)
   {
-    uint32_t posy = m_puiScanOrder[strPos].y;
-    uint32_t posx = m_puiScanOrder[strPos].x;
-    uint32_t posyprev = strPos == 0 ? 0 : m_puiScanOrder[strPos - 1].y;
-    uint32_t posxprev = strPos == 0 ? 0 : m_puiScanOrder[strPos - 1].x;
+    uint32_t posy = m_scanOrder[strPos].y;
+    uint32_t posx = m_scanOrder[strPos].x;
+    uint32_t posyprev = strPos == 0 ? 0 : m_scanOrder[strPos - 1].y;
+    uint32_t posxprev = strPos == 0 ? 0 : m_scanOrder[strPos - 1].x;
 
     if (indexMaxSize > 1)
     {
@@ -1789,8 +1789,8 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_
     for (int runidx = 1; runidx < runLength.at(posx, posy); runidx++)
     {
       int posYrun, posXrun;
-      posYrun = m_puiScanOrder[strPos + runidx].y;
-      posXrun = m_puiScanOrder[strPos + runidx].x;
+      posYrun = m_scanOrder[strPos + runidx].y;
+      posXrun = m_scanOrder[strPos + runidx].x;
       runType.at(posXrun, posYrun) = runType.at(posx, posy);
       runLength.at(posXrun, posYrun) = runLength.at(posx, posy);
     }
@@ -1801,8 +1801,8 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_
     {
       for (uint32_t idx = 1; idx < runLength.at(posx, posy); idx++)
       {
-        posYrun = m_puiScanOrder[strPos + idx].y;
-        posXrun = m_puiScanOrder[strPos + idx].x;
+        posYrun = m_scanOrder[strPos + idx].y;
+        posXrun = m_scanOrder[strPos + idx].x;
         curPLTIdx.at(posXrun, posYrun) = curPLTIdx.at(posx, posy);
       }
     }
@@ -1810,8 +1810,8 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_
     {
       for (uint32_t idx = 0; idx < runLength.at(posx, posy); idx++)
       {
-        posYrun = m_puiScanOrder[strPos + idx].y;
-        posXrun = m_puiScanOrder[strPos + idx].x;
+        posYrun = m_scanOrder[strPos + idx].y;
+        posXrun = m_scanOrder[strPos + idx].x;
         curPLTIdx.at(posXrun, posYrun) = (cu.useRotation[compBegin]) ? curPLTIdx.at(posXrun - 1, posYrun) : curPLTIdx.at(posXrun, posYrun - 1);
       }
     }
@@ -1826,8 +1826,8 @@ void CABACReader::cu_palette_info(CodingUnit& cu, ComponentID compBegin, uint32_
     ComponentID compID = (ComponentID)comp;
     for (strPos = 0; strPos < endPos; strPos++)
     {
-      uint32_t posy = m_puiScanOrder[strPos].y;
-      uint32_t posx = m_puiScanOrder[strPos].x;
+      uint32_t posy = m_scanOrder[strPos].y;
+      uint32_t posx = m_scanOrder[strPos].x;
       if (curPLTIdx.at(posx, posy) == cu.curPLTSize[compBegin])
       {
         {
@@ -1887,12 +1887,12 @@ void CABACReader::xAdjustPLTIndex(CodingUnit& cu, Pel curLevel, uint32_t idx, Pe
 {
   uint32_t symbol;
   int refLevel = MAX_INT;
-  uint32_t posy = m_puiScanOrder[idx].y;
-  uint32_t posx = m_puiScanOrder[idx].x;
+  uint32_t posy = m_scanOrder[idx].y;
+  uint32_t posx = m_scanOrder[idx].x;
   if (idx)
   {
-    uint32_t prevposy = m_puiScanOrder[idx - 1].y;
-    uint32_t prevposx = m_puiScanOrder[idx - 1].x;
+    uint32_t prevposy = m_scanOrder[idx - 1].y;
+    uint32_t prevposx = m_scanOrder[idx - 1].x;
     if (paletteRunType.at(prevposx, prevposy) == PLT_RUN_INDEX)
     {
       refLevel = paletteIdx.at(prevposx, prevposy);
@@ -1939,7 +1939,7 @@ uint32_t  CABACReader::cu_run_val(PLTRunMode runtype, const uint32_t paletteIdx,
   }
   else
   {
-    g_ucRunLeftLut[0] = (paletteIdx < PLT_RUN_MSB_IDX_CTX_T1 ? 0 : (paletteIdx < PLT_RUN_MSB_IDX_CTX_T2 ? 1 : 2));
+    g_paletteRunLeftLut[0] = (paletteIdx < PLT_RUN_MSB_IDX_CTX_T1 ? 0 : (paletteIdx < PLT_RUN_MSB_IDX_CTX_T2 ? 1 : 2));
   }
   symbol = xReadTruncMsbP1RefinementBits(runtype, maxRun, PLT_RUN_MSB_IDX_CABAC_BYPASS_THRE);
   return symbol;
@@ -1950,7 +1950,7 @@ uint32_t CABACReader::xReadTruncUnarySymbol(PLTRunMode runtype, uint32_t maxVal,
     return 0;
 
   uint8_t *ctxLut;
-  ctxLut = (runtype == PLT_RUN_INDEX) ? g_ucRunLeftLut : g_ucRunTopLut;
+  ctxLut = (runtype == PLT_RUN_INDEX) ? g_paletteRunLeftLut : g_paletteRunTopLut;
   uint32_t bin, idx = 0;
   do
   {
diff --git a/source/Lib/DecoderLib/CABACReader.h b/source/Lib/DecoderLib/CABACReader.h
index 4cd8e6ba8f17bbf5f1930b92dc90f5524d3117d2..a1956b3e3c3c41b92dbda7bacd1c19e655d7cd12 100644
--- a/source/Lib/DecoderLib/CABACReader.h
+++ b/source/Lib/DecoderLib/CABACReader.h
@@ -190,7 +190,7 @@ private:
   BinDecoderBase& m_BinDecoder;
   InputBitstream* m_Bitstream;
 #if JVET_O0119_BASE_PALETTE_444
-  ScanElement*    m_puiScanOrder;
+  ScanElement*    m_scanOrder;
 #endif
 };
 
diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp
index 7ef9c7b87a83ec829755ec10179c0cbfc17c454e..dbc83453b5d1d3a124bc4058d4c755c5f89ba2dc 100644
--- a/source/Lib/DecoderLib/VLCReader.cpp
+++ b/source/Lib/DecoderLib/VLCReader.cpp
@@ -1019,258 +1019,258 @@ void HLSyntaxReader::parseHrdParameters(HRDParameters *hrd, bool commonInfPresen
 
 void HLSyntaxReader::parseSPS(SPS* pcSPS)
 {
-	uint32_t  uiCode;
+  uint32_t  uiCode;
 
 #if ENABLE_TRACING
-	xTraceSPSHeader();
-#endif
-	READ_CODE(4, uiCode, "sps_decoding_parameter_set_id");       pcSPS->setDecodingParameterSetId(uiCode);
-	READ_CODE(3, uiCode, "sps_max_sub_layers_minus1");          pcSPS->setMaxTLayers(uiCode + 1);
-	CHECK(uiCode > 6, "Invalid maximum number of T-layer signalled");
-	READ_CODE(5, uiCode, "sps_reserved_zero_5bits");
-	CHECK(uiCode != 0, "sps_reserved_zero_5bits not equal to zero");
-
-	parseProfileTierLevel(pcSPS->getProfileTierLevel(), pcSPS->getMaxTLayers() - 1);
-
-	READ_UVLC(uiCode, "sps_seq_parameter_set_id");           pcSPS->setSPSId(uiCode);
-
-	READ_UVLC(uiCode, "chroma_format_idc");                  pcSPS->setChromaFormatIdc(ChromaFormat(uiCode));
-	CHECK(uiCode > 3, "Invalid chroma format signalled");
-
-
-
-	if (pcSPS->getChromaFormatIdc() == CHROMA_444)
-	{
-		READ_FLAG(uiCode, "separate_colour_plane_flag");        CHECK(uiCode != 0, "Invalid code");
-	}
-
-	READ_UVLC(uiCode, "pic_width_in_luma_samples");          pcSPS->setPicWidthInLumaSamples(uiCode);
-	READ_UVLC(uiCode, "pic_height_in_luma_samples");         pcSPS->setPicHeightInLumaSamples(uiCode);
-
-	// KJS: not removing yet
-	READ_FLAG(uiCode, "conformance_window_flag");
-	if (uiCode != 0)
-	{
-		Window &conf = pcSPS->getConformanceWindow();
-		READ_UVLC(uiCode, "conf_win_left_offset");               conf.setWindowLeftOffset(uiCode * SPS::getWinUnitX(pcSPS->getChromaFormatIdc()));
-		READ_UVLC(uiCode, "conf_win_right_offset");              conf.setWindowRightOffset(uiCode * SPS::getWinUnitX(pcSPS->getChromaFormatIdc()));
-		READ_UVLC(uiCode, "conf_win_top_offset");                conf.setWindowTopOffset(uiCode * SPS::getWinUnitY(pcSPS->getChromaFormatIdc()));
-		READ_UVLC(uiCode, "conf_win_bottom_offset");             conf.setWindowBottomOffset(uiCode * SPS::getWinUnitY(pcSPS->getChromaFormatIdc()));
-	}
-
-	READ_UVLC(uiCode, "bit_depth_luma_minus8");
-	CHECK(uiCode > 8, "Invalid luma bit depth signalled");
-	pcSPS->setBitDepth(CHANNEL_TYPE_LUMA, 8 + uiCode);
-
-	pcSPS->setQpBDOffset(CHANNEL_TYPE_LUMA, (int)(6 * uiCode));
-
-	READ_UVLC(uiCode, "bit_depth_chroma_minus8");
-	CHECK(uiCode > 8, "Invalid chroma bit depth signalled");
-	pcSPS->setBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode);
-	pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (int)(6 * uiCode));
-
-	READ_UVLC(uiCode, "log2_max_pic_order_cnt_lsb_minus4");   pcSPS->setBitsForPOC(4 + uiCode);
-	CHECK(uiCode > 12, "Invalid code");
-	READ_FLAG(uiCode, "sps_idr_rpl_present_flag"); pcSPS->setIDRRefParamListPresent((bool)uiCode);
-	// KJS: Marakech decision: sub-layers added back
-	uint32_t subLayerOrderingInfoPresentFlag;
-	READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag");
-
-	for (uint32_t i = 0; i <= pcSPS->getMaxTLayers() - 1; i++)
-	{
-		READ_UVLC(uiCode, "sps_max_dec_pic_buffering_minus1[i]");
-		pcSPS->setMaxDecPicBuffering(uiCode + 1, i);
-		READ_UVLC(uiCode, "sps_max_num_reorder_pics[i]");
-		pcSPS->setNumReorderPics(uiCode, i);
-		READ_UVLC(uiCode, "sps_max_latency_increase_plus1[i]");
-		pcSPS->setMaxLatencyIncreasePlus1(uiCode, i);
-
-		if (!subLayerOrderingInfoPresentFlag)
-		{
-			for (i++; i <= pcSPS->getMaxTLayers() - 1; i++)
-			{
-				pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i);
-				pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i);
-				pcSPS->setMaxLatencyIncreasePlus1(pcSPS->getMaxLatencyIncreasePlus1(0), i);
-			}
-			break;
-		}
-	}
-
-	READ_FLAG(uiCode, "long_term_ref_pics_flag");          pcSPS->setLongTermRefsPresent(uiCode);
-	READ_FLAG(uiCode, "rpl1_copy_from_rpl0_flag");
-	pcSPS->setRPL1CopyFromRPL0Flag(uiCode);
-
-	//Read candidate for List0
-	READ_UVLC(uiCode, "num_ref_pic_lists_in_sps[0]");
-	uint32_t numberOfRPL = uiCode;
-	pcSPS->createRPLList0(numberOfRPL);
-	RPLList* rplList = pcSPS->getRPLList0();
-	ReferencePictureList* rpl;
-	for (uint32_t ii = 0; ii < numberOfRPL; ii++)
-	{
-		rpl = rplList->getReferencePictureList(ii);
-		parseRefPicList(pcSPS, rpl);
-	}
-
-	//Read candidate for List1
-	if (!pcSPS->getRPL1CopyFromRPL0Flag())
-	{
-		READ_UVLC(uiCode, "num_ref_pic_lists_in_sps[1]");
-		numberOfRPL = uiCode;
-		pcSPS->createRPLList1(numberOfRPL);
-		rplList = pcSPS->getRPLList1();
-		for (uint32_t ii = 0; ii < numberOfRPL; ii++)
-		{
-			rpl = rplList->getReferencePictureList(ii);
-			parseRefPicList(pcSPS, rpl);
-		}
-	}
-	else
-	{
-		numberOfRPL = pcSPS->getNumRPL0();
-		pcSPS->createRPLList1(numberOfRPL);
-		RPLList* rplListSource = pcSPS->getRPLList0();
-		RPLList* rplListDest = pcSPS->getRPLList1();
-		for (uint32_t ii = 0; ii < numberOfRPL; ii++)
-			copyRefPicList(pcSPS, rplListSource->getReferencePictureList(ii), rplListDest->getReferencePictureList(ii));
-	}
-
-	unsigned  minQT[3] = { 0, 0, 0 };
-	unsigned  maxBTD[3] = { 0, 0, 0 };
-
-	unsigned  maxBTSize[3] = { 0, 0, 0 };
-	unsigned  maxTTSize[3] = { 0, 0, 0 };
-	READ_FLAG(uiCode, "qtbtt_dual_tree_intra_flag");             pcSPS->setUseDualITree(uiCode);
-	READ_UVLC(uiCode, "log2_ctu_size_minus2");                   pcSPS->setCTUSize(1 << (uiCode + 2));
-	pcSPS->setMaxCodingDepth(uiCode);
-	pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode);
-	pcSPS->setMaxCUWidth(pcSPS->getCTUSize());
-	pcSPS->setMaxCUHeight(pcSPS->getCTUSize());
-
-	READ_UVLC(uiCode, "log2_min_luma_coding_block_size_minus2");
-	int log2MinCUSize = uiCode + 2;
-	pcSPS->setLog2MinCodingBlockSize(log2MinCUSize);
-	READ_FLAG(uiCode, "partition_constraints_override_enabled_flag"); pcSPS->setSplitConsOverrideEnabledFlag(uiCode);
-	READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_intra_tile_group_luma");      minQT[0] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize());
-	READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_inter_tile_group");      minQT[1] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize());
-	READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_inter_tile_group");     maxBTD[1] = uiCode;
-	READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_intra_tile_group_luma");     maxBTD[0] = uiCode;
-
-	maxTTSize[0] = maxBTSize[0] = minQT[0];
-	if (maxBTD[0] != 0)
-	{
-		READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_intra_tile_group_luma");     maxBTSize[0] <<= uiCode;
-		READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_intra_tile_group_luma");     maxTTSize[0] <<= uiCode;
-	}
-	maxTTSize[1] = maxBTSize[1] = minQT[1];
-	if (maxBTD[1] != 0)
-	{
-		READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_inter_tile_group");     maxBTSize[1] <<= uiCode;
-		READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_inter_tile_group");     maxTTSize[1] <<= uiCode;
-	}
-	if (pcSPS->getUseDualITree())
-	{
-		READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_intra_tile_group_chroma"); minQT[2] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize());
-		READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_intra_tile_group_chroma"); maxBTD[2] = uiCode;
-		maxTTSize[2] = maxBTSize[2] = minQT[2];
-		if (maxBTD[2] != 0)
-		{
-			READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_intra_tile_group_chroma");       maxBTSize[2] <<= uiCode;
-			READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_intra_tile_group_chroma");       maxTTSize[2] <<= uiCode;
-		}
-	}
-
-	pcSPS->setMinQTSizes(minQT);
-	pcSPS->setMaxBTDepth(maxBTD[1], maxBTD[0], maxBTD[2]);
-	pcSPS->setMaxBTSize(maxBTSize[1], maxBTSize[0], maxBTSize[2]);
-	pcSPS->setMaxTTSize(maxTTSize[1], maxTTSize[0], maxTTSize[2]);
+  xTraceSPSHeader();
+#endif
+  READ_CODE(4, uiCode, "sps_decoding_parameter_set_id");       pcSPS->setDecodingParameterSetId(uiCode);
+  READ_CODE(3, uiCode, "sps_max_sub_layers_minus1");          pcSPS->setMaxTLayers(uiCode + 1);
+  CHECK(uiCode > 6, "Invalid maximum number of T-layer signalled");
+  READ_CODE(5, uiCode, "sps_reserved_zero_5bits");
+  CHECK(uiCode != 0, "sps_reserved_zero_5bits not equal to zero");
+
+  parseProfileTierLevel(pcSPS->getProfileTierLevel(), pcSPS->getMaxTLayers() - 1);
+
+  READ_UVLC(uiCode, "sps_seq_parameter_set_id");           pcSPS->setSPSId(uiCode);
+
+  READ_UVLC(uiCode, "chroma_format_idc");                  pcSPS->setChromaFormatIdc(ChromaFormat(uiCode));
+  CHECK(uiCode > 3, "Invalid chroma format signalled");
+
+
+
+  if (pcSPS->getChromaFormatIdc() == CHROMA_444)
+  {
+    READ_FLAG(uiCode, "separate_colour_plane_flag");        CHECK(uiCode != 0, "Invalid code");
+  }
+
+  READ_UVLC(uiCode, "pic_width_in_luma_samples");          pcSPS->setPicWidthInLumaSamples(uiCode);
+  READ_UVLC(uiCode, "pic_height_in_luma_samples");         pcSPS->setPicHeightInLumaSamples(uiCode);
+
+  // KJS: not removing yet
+  READ_FLAG(uiCode, "conformance_window_flag");
+  if (uiCode != 0)
+  {
+    Window &conf = pcSPS->getConformanceWindow();
+    READ_UVLC(uiCode, "conf_win_left_offset");               conf.setWindowLeftOffset(uiCode * SPS::getWinUnitX(pcSPS->getChromaFormatIdc()));
+    READ_UVLC(uiCode, "conf_win_right_offset");              conf.setWindowRightOffset(uiCode * SPS::getWinUnitX(pcSPS->getChromaFormatIdc()));
+    READ_UVLC(uiCode, "conf_win_top_offset");                conf.setWindowTopOffset(uiCode * SPS::getWinUnitY(pcSPS->getChromaFormatIdc()));
+    READ_UVLC(uiCode, "conf_win_bottom_offset");             conf.setWindowBottomOffset(uiCode * SPS::getWinUnitY(pcSPS->getChromaFormatIdc()));
+  }
+
+  READ_UVLC(uiCode, "bit_depth_luma_minus8");
+  CHECK(uiCode > 8, "Invalid luma bit depth signalled");
+  pcSPS->setBitDepth(CHANNEL_TYPE_LUMA, 8 + uiCode);
+
+  pcSPS->setQpBDOffset(CHANNEL_TYPE_LUMA, (int)(6 * uiCode));
+
+  READ_UVLC(uiCode, "bit_depth_chroma_minus8");
+  CHECK(uiCode > 8, "Invalid chroma bit depth signalled");
+  pcSPS->setBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode);
+  pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (int)(6 * uiCode));
+
+  READ_UVLC(uiCode, "log2_max_pic_order_cnt_lsb_minus4");   pcSPS->setBitsForPOC(4 + uiCode);
+  CHECK(uiCode > 12, "Invalid code");
+  READ_FLAG(uiCode, "sps_idr_rpl_present_flag"); pcSPS->setIDRRefParamListPresent((bool)uiCode);
+  // KJS: Marakech decision: sub-layers added back
+  uint32_t subLayerOrderingInfoPresentFlag;
+  READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag");
+
+  for (uint32_t i = 0; i <= pcSPS->getMaxTLayers() - 1; i++)
+  {
+    READ_UVLC(uiCode, "sps_max_dec_pic_buffering_minus1[i]");
+    pcSPS->setMaxDecPicBuffering(uiCode + 1, i);
+    READ_UVLC(uiCode, "sps_max_num_reorder_pics[i]");
+    pcSPS->setNumReorderPics(uiCode, i);
+    READ_UVLC(uiCode, "sps_max_latency_increase_plus1[i]");
+    pcSPS->setMaxLatencyIncreasePlus1(uiCode, i);
+
+    if (!subLayerOrderingInfoPresentFlag)
+    {
+      for (i++; i <= pcSPS->getMaxTLayers() - 1; i++)
+      {
+        pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i);
+        pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i);
+        pcSPS->setMaxLatencyIncreasePlus1(pcSPS->getMaxLatencyIncreasePlus1(0), i);
+      }
+      break;
+    }
+  }
+
+  READ_FLAG(uiCode, "long_term_ref_pics_flag");          pcSPS->setLongTermRefsPresent(uiCode);
+  READ_FLAG(uiCode, "rpl1_copy_from_rpl0_flag");
+  pcSPS->setRPL1CopyFromRPL0Flag(uiCode);
+
+  //Read candidate for List0
+  READ_UVLC(uiCode, "num_ref_pic_lists_in_sps[0]");
+  uint32_t numberOfRPL = uiCode;
+  pcSPS->createRPLList0(numberOfRPL);
+  RPLList* rplList = pcSPS->getRPLList0();
+  ReferencePictureList* rpl;
+  for (uint32_t ii = 0; ii < numberOfRPL; ii++)
+  {
+    rpl = rplList->getReferencePictureList(ii);
+    parseRefPicList(pcSPS, rpl);
+  }
+
+  //Read candidate for List1
+  if (!pcSPS->getRPL1CopyFromRPL0Flag())
+  {
+    READ_UVLC(uiCode, "num_ref_pic_lists_in_sps[1]");
+    numberOfRPL = uiCode;
+    pcSPS->createRPLList1(numberOfRPL);
+    rplList = pcSPS->getRPLList1();
+    for (uint32_t ii = 0; ii < numberOfRPL; ii++)
+    {
+      rpl = rplList->getReferencePictureList(ii);
+      parseRefPicList(pcSPS, rpl);
+    }
+  }
+  else
+  {
+    numberOfRPL = pcSPS->getNumRPL0();
+    pcSPS->createRPLList1(numberOfRPL);
+    RPLList* rplListSource = pcSPS->getRPLList0();
+    RPLList* rplListDest = pcSPS->getRPLList1();
+    for (uint32_t ii = 0; ii < numberOfRPL; ii++)
+      copyRefPicList(pcSPS, rplListSource->getReferencePictureList(ii), rplListDest->getReferencePictureList(ii));
+  }
+
+  unsigned  minQT[3] = { 0, 0, 0 };
+  unsigned  maxBTD[3] = { 0, 0, 0 };
+
+  unsigned  maxBTSize[3] = { 0, 0, 0 };
+  unsigned  maxTTSize[3] = { 0, 0, 0 };
+  READ_FLAG(uiCode, "qtbtt_dual_tree_intra_flag");             pcSPS->setUseDualITree(uiCode);
+  READ_UVLC(uiCode, "log2_ctu_size_minus2");                   pcSPS->setCTUSize(1 << (uiCode + 2));
+  pcSPS->setMaxCodingDepth(uiCode);
+  pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode);
+  pcSPS->setMaxCUWidth(pcSPS->getCTUSize());
+  pcSPS->setMaxCUHeight(pcSPS->getCTUSize());
+
+  READ_UVLC(uiCode, "log2_min_luma_coding_block_size_minus2");
+  int log2MinCUSize = uiCode + 2;
+  pcSPS->setLog2MinCodingBlockSize(log2MinCUSize);
+  READ_FLAG(uiCode, "partition_constraints_override_enabled_flag"); pcSPS->setSplitConsOverrideEnabledFlag(uiCode);
+  READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_intra_tile_group_luma");      minQT[0] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize());
+  READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_inter_tile_group");      minQT[1] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize());
+  READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_inter_tile_group");     maxBTD[1] = uiCode;
+  READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_intra_tile_group_luma");     maxBTD[0] = uiCode;
+
+  maxTTSize[0] = maxBTSize[0] = minQT[0];
+  if (maxBTD[0] != 0)
+  {
+    READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_intra_tile_group_luma");     maxBTSize[0] <<= uiCode;
+    READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_intra_tile_group_luma");     maxTTSize[0] <<= uiCode;
+  }
+  maxTTSize[1] = maxBTSize[1] = minQT[1];
+  if (maxBTD[1] != 0)
+  {
+    READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_inter_tile_group");     maxBTSize[1] <<= uiCode;
+    READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_inter_tile_group");     maxTTSize[1] <<= uiCode;
+  }
+  if (pcSPS->getUseDualITree())
+  {
+    READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_intra_tile_group_chroma"); minQT[2] = 1 << (uiCode + pcSPS->getLog2MinCodingBlockSize());
+    READ_UVLC(uiCode, "sps_max_mtt_hierarchy_depth_intra_tile_group_chroma"); maxBTD[2] = uiCode;
+    maxTTSize[2] = maxBTSize[2] = minQT[2];
+    if (maxBTD[2] != 0)
+    {
+      READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_intra_tile_group_chroma");       maxBTSize[2] <<= uiCode;
+      READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_intra_tile_group_chroma");       maxTTSize[2] <<= uiCode;
+    }
+  }
+
+  pcSPS->setMinQTSizes(minQT);
+  pcSPS->setMaxBTDepth(maxBTD[1], maxBTD[0], maxBTD[2]);
+  pcSPS->setMaxBTSize(maxBTSize[1], maxBTSize[0], maxBTSize[2]);
+  pcSPS->setMaxTTSize(maxTTSize[1], maxTTSize[0], maxTTSize[2]);
 
 
 #if MAX_TB_SIZE_SIGNALLING
-	// KJS: Not in syntax
-	READ_UVLC(uiCode, "log2_max_luma_transform_block_size_minus2"); pcSPS->setLog2MaxTbSize(uiCode + 2);
-#endif
-	READ_FLAG(uiCode, "sps_sao_enabled_flag");                      pcSPS->setSAOEnabledFlag(uiCode ? true : false);
-	READ_FLAG(uiCode, "sps_alf_enabled_flag");                      pcSPS->setALFEnabledFlag(uiCode ? true : false);
-
-	READ_FLAG(uiCode, "sps_pcm_enabled_flag");                          pcSPS->setPCMEnabledFlag(uiCode ? true : false);
-	if (pcSPS->getPCMEnabledFlag())
-	{
-		READ_CODE(4, uiCode, "pcm_sample_bit_depth_luma_minus1");          pcSPS->setPCMBitDepth(CHANNEL_TYPE_LUMA, 1 + uiCode);
-		READ_CODE(4, uiCode, "pcm_sample_bit_depth_chroma_minus1");        pcSPS->setPCMBitDepth(CHANNEL_TYPE_CHROMA, 1 + uiCode);
-		READ_UVLC(uiCode, "log2_min_pcm_luma_coding_block_size_minus3");   pcSPS->setPCMLog2MinSize(uiCode + 3);
-		READ_UVLC(uiCode, "log2_diff_max_min_pcm_luma_coding_block_size"); pcSPS->setPCMLog2MaxSize(uiCode + pcSPS->getPCMLog2MinSize());
-		READ_FLAG(uiCode, "pcm_loop_filter_disable_flag");                 pcSPS->setPCMFilterDisableFlag(uiCode ? true : false);
-	}
+  // KJS: Not in syntax
+  READ_UVLC(uiCode, "log2_max_luma_transform_block_size_minus2"); pcSPS->setLog2MaxTbSize(uiCode + 2);
+#endif
+  READ_FLAG(uiCode, "sps_sao_enabled_flag");                      pcSPS->setSAOEnabledFlag(uiCode ? true : false);
+  READ_FLAG(uiCode, "sps_alf_enabled_flag");                      pcSPS->setALFEnabledFlag(uiCode ? true : false);
+
+  READ_FLAG(uiCode, "sps_pcm_enabled_flag");                          pcSPS->setPCMEnabledFlag(uiCode ? true : false);
+  if (pcSPS->getPCMEnabledFlag())
+  {
+    READ_CODE(4, uiCode, "pcm_sample_bit_depth_luma_minus1");          pcSPS->setPCMBitDepth(CHANNEL_TYPE_LUMA, 1 + uiCode);
+    READ_CODE(4, uiCode, "pcm_sample_bit_depth_chroma_minus1");        pcSPS->setPCMBitDepth(CHANNEL_TYPE_CHROMA, 1 + uiCode);
+    READ_UVLC(uiCode, "log2_min_pcm_luma_coding_block_size_minus3");   pcSPS->setPCMLog2MinSize(uiCode + 3);
+    READ_UVLC(uiCode, "log2_diff_max_min_pcm_luma_coding_block_size"); pcSPS->setPCMLog2MaxSize(uiCode + pcSPS->getPCMLog2MinSize());
+    READ_FLAG(uiCode, "pcm_loop_filter_disable_flag");                 pcSPS->setPCMFilterDisableFlag(uiCode ? true : false);
+  }
 
 #if JVET_O1136_TS_BDPCM_SIGNALLING
-	READ_FLAG(uiCode, "sps_transform_skip_enabled_flag"); pcSPS->setTransformSkipEnabledFlag(uiCode ? true : false);
-	if (pcSPS->getTransformSkipEnabledFlag())
-	{
-		READ_FLAG(uiCode, "sps_bdpcm_enabled_flag"); pcSPS->setBDPCMEnabledFlag(uiCode ? true : false);
-	}
-#endif
-
-	if (pcSPS->getCTUSize() + 2 * (1 << pcSPS->getLog2MinCodingBlockSize()) <= pcSPS->getPicWidthInLumaSamples())
-	{
-		READ_FLAG(uiCode, "sps_ref_wraparound_enabled_flag");                  pcSPS->setWrapAroundEnabledFlag(uiCode ? true : false);
-
-		if (pcSPS->getWrapAroundEnabledFlag())
-		{
-			READ_UVLC(uiCode, "sps_ref_wraparound_offset_minus1");               pcSPS->setWrapAroundOffset((uiCode + 1)*(1 << pcSPS->getLog2MinCodingBlockSize()));
-		}
-	}
-	else
-	{
-		pcSPS->setWrapAroundEnabledFlag(0);
-	}
-
-
-	READ_FLAG(uiCode, "sps_temporal_mvp_enabled_flag");                  pcSPS->setSPSTemporalMVPEnabledFlag(uiCode);
-
-	if (pcSPS->getSPSTemporalMVPEnabledFlag())
-	{
-		READ_FLAG(uiCode, "sps_sbtmvp_enabled_flag");                   pcSPS->setSBTMVPEnabledFlag(uiCode != 0);
-	}
-	else
-	{
-		pcSPS->setSBTMVPEnabledFlag(false);
-	}
-
-	READ_FLAG(uiCode, "sps_amvr_enabled_flag");                     pcSPS->setAMVREnabledFlag(uiCode != 0);
-
-	READ_FLAG(uiCode, "sps_bdof_enabled_flag");                      pcSPS->setBDOFEnabledFlag(uiCode != 0);
+  READ_FLAG(uiCode, "sps_transform_skip_enabled_flag"); pcSPS->setTransformSkipEnabledFlag(uiCode ? true : false);
+  if (pcSPS->getTransformSkipEnabledFlag())
+  {
+    READ_FLAG(uiCode, "sps_bdpcm_enabled_flag"); pcSPS->setBDPCMEnabledFlag(uiCode ? true : false);
+  }
+#endif
+
+  if (pcSPS->getCTUSize() + 2 * (1 << pcSPS->getLog2MinCodingBlockSize()) <= pcSPS->getPicWidthInLumaSamples())
+  {
+    READ_FLAG(uiCode, "sps_ref_wraparound_enabled_flag");                  pcSPS->setWrapAroundEnabledFlag(uiCode ? true : false);
+
+    if (pcSPS->getWrapAroundEnabledFlag())
+    {
+      READ_UVLC(uiCode, "sps_ref_wraparound_offset_minus1");               pcSPS->setWrapAroundOffset((uiCode + 1)*(1 << pcSPS->getLog2MinCodingBlockSize()));
+    }
+  }
+  else
+  {
+    pcSPS->setWrapAroundEnabledFlag(0);
+  }
+
+
+  READ_FLAG(uiCode, "sps_temporal_mvp_enabled_flag");                  pcSPS->setSPSTemporalMVPEnabledFlag(uiCode);
+
+  if (pcSPS->getSPSTemporalMVPEnabledFlag())
+  {
+    READ_FLAG(uiCode, "sps_sbtmvp_enabled_flag");                   pcSPS->setSBTMVPEnabledFlag(uiCode != 0);
+  }
+  else
+  {
+    pcSPS->setSBTMVPEnabledFlag(false);
+  }
+
+  READ_FLAG(uiCode, "sps_amvr_enabled_flag");                     pcSPS->setAMVREnabledFlag(uiCode != 0);
+
+  READ_FLAG(uiCode, "sps_bdof_enabled_flag");                      pcSPS->setBDOFEnabledFlag(uiCode != 0);
 #if !JVET_O0438_SPS_AFFINE_AMVR_FLAG
-	READ_FLAG(uiCode, "sps_affine_amvr_enabled_flag");             pcSPS->setAffineAmvrEnabledFlag(uiCode != 0);
-#endif
-	READ_FLAG(uiCode, "sps_dmvr_enable_flag");                        pcSPS->setUseDMVR(uiCode != 0);
-	READ_FLAG(uiCode, "sps_mmvd_enable_flag");                        pcSPS->setUseMMVD(uiCode != 0);
-	// KJS: sps_cclm_enabled_flag
-	READ_FLAG(uiCode, "lm_chroma_enabled_flag");                 pcSPS->setUseLMChroma(uiCode != 0);
-	if (pcSPS->getUseLMChroma() && pcSPS->getChromaFormatIdc() == CHROMA_420)
-	{
-		READ_FLAG(uiCode, "sps_cclm_collocated_chroma_flag");        pcSPS->setCclmCollocatedChromaFlag(uiCode != 0);
-	}
-
-	READ_FLAG(uiCode, "mts_enabled_flag");                       pcSPS->setUseMTS(uiCode != 0);
-	if (pcSPS->getUseMTS())
-	{
-		READ_FLAG(uiCode, "mts_intra_enabled_flag");               pcSPS->setUseIntraMTS(uiCode != 0);
-		READ_FLAG(uiCode, "mts_inter_enabled_flag");               pcSPS->setUseInterMTS(uiCode != 0);
-	}
-	READ_FLAG(uiCode, "lfnst_enabled_flag");                        pcSPS->setUseLFNST(uiCode != 0);
-	READ_FLAG(uiCode, "smvd_flag");                                   pcSPS->setUseSMVD(uiCode != 0);
-	// KJS: sps_affine_enabled_flag
-	READ_FLAG(uiCode, "affine_flag");                            pcSPS->setUseAffine(uiCode != 0);
-	if (pcSPS->getUseAffine())
-	{
-		READ_FLAG(uiCode, "affine_type_flag");                       pcSPS->setUseAffineType(uiCode != 0);
+  READ_FLAG(uiCode, "sps_affine_amvr_enabled_flag");             pcSPS->setAffineAmvrEnabledFlag(uiCode != 0);
+#endif
+  READ_FLAG(uiCode, "sps_dmvr_enable_flag");                        pcSPS->setUseDMVR(uiCode != 0);
+  READ_FLAG(uiCode, "sps_mmvd_enable_flag");                        pcSPS->setUseMMVD(uiCode != 0);
+  // KJS: sps_cclm_enabled_flag
+  READ_FLAG(uiCode, "lm_chroma_enabled_flag");                 pcSPS->setUseLMChroma(uiCode != 0);
+  if (pcSPS->getUseLMChroma() && pcSPS->getChromaFormatIdc() == CHROMA_420)
+  {
+    READ_FLAG(uiCode, "sps_cclm_collocated_chroma_flag");        pcSPS->setCclmCollocatedChromaFlag(uiCode != 0);
+  }
+
+  READ_FLAG(uiCode, "mts_enabled_flag");                       pcSPS->setUseMTS(uiCode != 0);
+  if (pcSPS->getUseMTS())
+  {
+    READ_FLAG(uiCode, "mts_intra_enabled_flag");               pcSPS->setUseIntraMTS(uiCode != 0);
+    READ_FLAG(uiCode, "mts_inter_enabled_flag");               pcSPS->setUseInterMTS(uiCode != 0);
+  }
+  READ_FLAG(uiCode, "lfnst_enabled_flag");                        pcSPS->setUseLFNST(uiCode != 0);
+  READ_FLAG(uiCode, "smvd_flag");                                   pcSPS->setUseSMVD(uiCode != 0);
+  // KJS: sps_affine_enabled_flag
+  READ_FLAG(uiCode, "affine_flag");                            pcSPS->setUseAffine(uiCode != 0);
+  if (pcSPS->getUseAffine())
+  {
+    READ_FLAG(uiCode, "affine_type_flag");                       pcSPS->setUseAffineType(uiCode != 0);
 #if JVET_O0438_SPS_AFFINE_AMVR_FLAG
-		READ_FLAG(uiCode, "sps_affine_amvr_enabled_flag");           pcSPS->setAffineAmvrEnabledFlag(uiCode != 0);
+    READ_FLAG(uiCode, "sps_affine_amvr_enabled_flag");           pcSPS->setAffineAmvrEnabledFlag(uiCode != 0);
 #endif
-	}
-	READ_FLAG(uiCode, "gbi_flag");                               pcSPS->setUseGBi(uiCode != 0);
+  }
+  READ_FLAG(uiCode, "gbi_flag");                               pcSPS->setUseGBi(uiCode != 0);
 #if JVET_O0119_BASE_PALETTE_444
   if (pcSPS->getChromaFormatIdc() == CHROMA_444)
   {
@@ -1788,8 +1788,8 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
           READ_CODE(5, uiCode, "tile_group_aps_id");
           apsId[i] = uiCode;
         }
-		
-		
+    
+    
         pcSlice->setAlfAPSs(apsId);
         alfChromaIdc = truncatedUnaryEqProb(3);        //alf_chroma_idc
         if (alfChromaIdc)
diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp
index 1e31b1dc50e52b02730c5bbace8784b0dd3d3622..cf3bd974e0bb0c32b4545c472879aba8c26c79e9 100644
--- a/source/Lib/EncoderLib/CABACWriter.cpp
+++ b/source/Lib/EncoderLib/CABACWriter.cpp
@@ -1498,7 +1498,7 @@ void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, u
   uint32_t   height = cu.block(compBegin).height;
   uint32_t   width = cu.block(compBegin).width;
 
-  m_puiScanOrder = g_scanOrder[SCAN_UNGROUPED][(cu.useRotation[compBegin]) ? SCAN_TRAV_VER : SCAN_TRAV_HOR][gp_sizeIdxInfo->idxFrom(width)][gp_sizeIdxInfo->idxFrom(height)];
+  m_scanOrder = g_scanOrder[SCAN_UNGROUPED][(cu.useRotation[compBegin]) ? SCAN_TRAV_VER : SCAN_TRAV_HOR][gp_sizeIdxInfo->idxFrom(width)][gp_sizeIdxInfo->idxFrom(height)];
   uint32_t total = height * width;
   int lastRunPos = -1;
   uint32_t lastRunType = 0;
@@ -1511,8 +1511,8 @@ void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, u
     int idx = 0, run = 0;
     while (idx < total)
     {
-      uint32_t posy = m_puiScanOrder[idx].y;
-      uint32_t posx = m_puiScanOrder[idx].x;
+      uint32_t posy = m_scanOrder[idx].y;
+      uint32_t posx = m_scanOrder[idx].x;
       if (runType.at(posx, posy) == PLT_RUN_INDEX)
       {
         idxPos.push_back(idx);
@@ -1570,10 +1570,10 @@ void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, u
   auto parsedIdxIter = parsedIdx.begin();
   while (strPos < endPos)
   {
-    uint32_t posy = m_puiScanOrder[strPos].y;
-    uint32_t posx = m_puiScanOrder[strPos].x;
-    uint32_t posyprev = strPos == 0 ? 0 : m_puiScanOrder[strPos - 1].y;
-    uint32_t posxprev = strPos == 0 ? 0 : m_puiScanOrder[strPos - 1].x;
+    uint32_t posy = m_scanOrder[strPos].y;
+    uint32_t posx = m_scanOrder[strPos].x;
+    uint32_t posyprev = strPos == 0 ? 0 : m_scanOrder[strPos - 1].y;
+    uint32_t posxprev = strPos == 0 ? 0 : m_scanOrder[strPos - 1].x;
 
     if (indexMaxSize > 1)
     {
@@ -1629,8 +1629,8 @@ void CABACWriter::cu_palette_info(const CodingUnit& cu, ComponentID compBegin, u
     ComponentID compID = (ComponentID)comp;
     for (strPos = 0; strPos < endPos; strPos++)
     {
-      uint32_t posy = m_puiScanOrder[strPos].y;
-      uint32_t posx = m_puiScanOrder[strPos].x;
+      uint32_t posy = m_scanOrder[strPos].y;
+      uint32_t posx = m_scanOrder[strPos].x;
       if (curPLTIdx.at(posx, posy) == cu.curPLTSize[compBegin])
       {
         {
@@ -1690,13 +1690,13 @@ void CABACWriter::xEncodePLTPredIndicator(const CodingUnit& cu, uint32_t maxPLTS
 }
 Pel CABACWriter::writePLTIndex(const CodingUnit& cu, uint32_t idx, PelBuf& paletteIdx, PLTtypeBuf& paletteRunType, int maxSymbol, ComponentID compBegin)
 {
-  uint32_t posy = m_puiScanOrder[idx].y;
-  uint32_t posx = m_puiScanOrder[idx].x;
+  uint32_t posy = m_scanOrder[idx].y;
+  uint32_t posx = m_scanOrder[idx].x;
   Pel curLevel = (paletteIdx.at(posx, posy) == cu.curPLTSize[compBegin]) ? (maxSymbol - 1) : paletteIdx.at(posx, posy);
   if (idx) // R0348: remove index redundancy
   {
-    uint32_t prevposy = m_puiScanOrder[idx - 1].y;
-    uint32_t prevposx = m_puiScanOrder[idx - 1].x;
+    uint32_t prevposy = m_scanOrder[idx - 1].y;
+    uint32_t prevposx = m_scanOrder[idx - 1].x;
     if (paletteRunType.at(prevposx, prevposy) == PLT_RUN_INDEX)
     {
       Pel leftLevel = paletteIdx.at(prevposx, prevposy); // left index
@@ -1753,12 +1753,12 @@ void CABACWriter::encodeRunType(const CodingUnit&  cu, PLTtypeBuf& runType, uint
 {
   if (refScanOrder)
   {
-    m_puiScanOrder = refScanOrder;
+    m_scanOrder = refScanOrder;
   }
-  uint32_t posy = m_puiScanOrder[idx].y;
-  uint32_t posx = m_puiScanOrder[idx].x;
-  uint32_t posyprev = (idx == 0) ? 0 : m_puiScanOrder[idx - 1].y;
-  uint32_t posxprev = (idx == 0) ? 0 : m_puiScanOrder[idx - 1].x;
+  uint32_t posy = m_scanOrder[idx].y;
+  uint32_t posx = m_scanOrder[idx].x;
+  uint32_t posyprev = (idx == 0) ? 0 : m_scanOrder[idx - 1].y;
+  uint32_t posxprev = (idx == 0) ? 0 : m_scanOrder[idx - 1].x;
 
   if (((posy == 0) && !cu.useRotation[compBegin]) || ((posx == 0) && cu.useRotation[compBegin]))
   {
@@ -1781,7 +1781,7 @@ void CABACWriter::cu_run_val(uint32_t run, PLTRunMode runtype, const uint32_t pa
   }
   else
   {
-    g_ucRunLeftLut[0] = (paletteIdx < PLT_RUN_MSB_IDX_CTX_T1 ? 0 : (paletteIdx < PLT_RUN_MSB_IDX_CTX_T2 ? 1 : 2));
+    g_paletteRunLeftLut[0] = (paletteIdx < PLT_RUN_MSB_IDX_CTX_T1 ? 0 : (paletteIdx < PLT_RUN_MSB_IDX_CTX_T2 ? 1 : 2));
   }
   xWriteTruncMsbP1RefinementBits(run, runtype, maxRun, PLT_RUN_MSB_IDX_CABAC_BYPASS_THRE);
 }
@@ -1791,7 +1791,7 @@ uint32_t CABACWriter::xWriteTruncMsbP1(uint32_t symbol, PLTRunMode runtype, uint
     return 0;
 
   uint8_t *ctxLut;
-  ctxLut = (runtype == PLT_RUN_INDEX) ? g_ucRunLeftLut : g_ucRunTopLut;
+  ctxLut = (runtype == PLT_RUN_INDEX) ? g_paletteRunLeftLut : g_paletteRunTopLut;
 
   uint32_t msbP1;
   for (msbP1 = 0; symbol > 0; msbP1++)
diff --git a/source/Lib/EncoderLib/CABACWriter.h b/source/Lib/EncoderLib/CABACWriter.h
index 617b33b8f192cbbe6e6df591dafb9c7ee5f59e77..2c4a7c36b5f25d3f6e3de93b91b6dc06fcaacf44 100644
--- a/source/Lib/EncoderLib/CABACWriter.h
+++ b/source/Lib/EncoderLib/CABACWriter.h
@@ -204,7 +204,7 @@ private:
   Ctx               m_TestCtx;
   EncCu*            m_EncCu;
 #if JVET_O0119_BASE_PALETTE_444
-  ScanElement*      m_puiScanOrder;
+  ScanElement*      m_scanOrder;
 #endif
 };
 
diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp
index 309cbcb940b86237aa79306d6f09a4cbccc9e8eb..9d1234bf5a94940528767e0b73f6cfcde988d426 100644
--- a/source/Lib/EncoderLib/IntraSearch.cpp
+++ b/source/Lib/EncoderLib/IntraSearch.cpp
@@ -1492,7 +1492,7 @@ void IntraSearch::PLTSearch(CodingStructure &cs, Partitioner& partitioner, Compo
   {
     deriveRunAndCalcBits(cs, partitioner, compBegin, numComp, PLT_SCAN_VERTRAV, bits);
   }
-  cu.useRotation[compBegin] = m_bBestScanRotationMode;
+  cu.useRotation[compBegin] = m_bestScanRotationMode;
   memcpy(runType, m_runTypeRD, sizeof(bool)*width*height);
   memcpy(runLength, m_runLengthRD, sizeof(Pel)*width*height);
   //reconstruct pixel
@@ -1578,7 +1578,7 @@ void IntraSearch::deriveRunAndCalcBits(CodingStructure& cs, Partitioner& partiti
   bool *runType   = tu.getRunTypes(compBegin);
 
   cu.useRotation[compBegin] = (pltScanMode == PLT_SCAN_VERTRAV); 
-  m_puiScanOrder = g_scanOrder[SCAN_UNGROUPED][(cu.useRotation[compBegin]) ? SCAN_TRAV_VER : SCAN_TRAV_HOR][gp_sizeIdxInfo->idxFrom(width)][gp_sizeIdxInfo->idxFrom(height)];
+  m_scanOrder = g_scanOrder[SCAN_UNGROUPED][(cu.useRotation[compBegin]) ? SCAN_TRAV_VER : SCAN_TRAV_HOR][gp_sizeIdxInfo->idxFrom(width)][gp_sizeIdxInfo->idxFrom(height)];
   deriveRun(cs, partitioner, compBegin);
 
   m_CABACEstimator->getCtx() = PLTCtx(m_orgCtxRD);
@@ -1590,7 +1590,7 @@ void IntraSearch::deriveRunAndCalcBits(CodingStructure& cs, Partitioner& partiti
   uint64_t bitsTemp = m_CABACEstimator->getEstFracBits();
   if (minBits > bitsTemp)
   {
-    m_bBestScanRotationMode = pltScanMode;
+    m_bestScanRotationMode = pltScanMode;
     memcpy(m_runTypeRD, runType, sizeof(bool)*width*height);
     memcpy(m_runLengthRD, runLength, sizeof(Pel)*width*height);
     minBits = bitsTemp;
@@ -1605,7 +1605,7 @@ void IntraSearch::deriveRun(CodingStructure& cs, Partitioner& partitioner, Compo
   uint32_t total = height * width, idx = 0;
   uint32_t startPos = 0;
   uint64_t indexBits = 0, runBitsIndex = 0, runBitsCopy = 0;
-  m_storeCtx_Run = PLTCtx(m_orgCtxRD);
+  m_storeCtxRun = PLTCtx(m_orgCtxRD);
 
   PLTtypeBuf  runType = tu.getrunType(compBegin);
   PelBuf      runLength = tu.getrunLength(compBegin);
@@ -1615,15 +1615,15 @@ void IntraSearch::deriveRun(CodingStructure& cs, Partitioner& partitioner, Compo
     double aveBitsPerPix[NUM_PLT_RUN];
     uint32_t indexRun = 0;
     bool runValid = calIndexRun(cs, partitioner, startPos, total, indexRun, compBegin);
-    m_CABACEstimator->getCtx() = PLTCtx(m_storeCtx_Run);
+    m_CABACEstimator->getCtx() = PLTCtx(m_storeCtxRun);
     aveBitsPerPix[PLT_RUN_INDEX] = runValid ? getRunBits(cu, indexRun, startPos, PLT_RUN_INDEX, &indexBits, &runBitsIndex, compBegin) : MAX_DOUBLE;
-    m_storeCtx_RunIndex = PLTCtx(m_CABACEstimator->getCtx());
+    m_storeCtxRunIndex = PLTCtx(m_CABACEstimator->getCtx());
 
     uint32_t copyRun = 0;
     bool copyValid = calCopyRun(cs, partitioner, startPos, total, copyRun, compBegin);
-    m_CABACEstimator->getCtx() = PLTCtx(m_storeCtx_Run);
+    m_CABACEstimator->getCtx() = PLTCtx(m_storeCtxRun);
     aveBitsPerPix[PLT_RUN_COPY] = copyValid ? getRunBits(cu, copyRun, startPos, PLT_RUN_COPY, &indexBits, &runBitsCopy, compBegin) : MAX_DOUBLE;
-    m_storeCtx_RunCopy = PLTCtx(m_CABACEstimator->getCtx());
+    m_storeCtxRunCopy = PLTCtx(m_CABACEstimator->getCtx());
 
     if (copyValid == 0 && runValid == 0)
     {
@@ -1635,26 +1635,26 @@ void IntraSearch::deriveRun(CodingStructure& cs, Partitioner& partitioner, Compo
       {
         for (int runidx = 0; runidx <copyRun; runidx++)
         {
-          uint32_t posy = m_puiScanOrder[idx + runidx].y;
-          uint32_t posx = m_puiScanOrder[idx + runidx].x;
+          uint32_t posy = m_scanOrder[idx + runidx].y;
+          uint32_t posx = m_scanOrder[idx + runidx].x;
           runType.at(posx, posy) = PLT_RUN_COPY;
           runLength.at(posx, posy) = copyRun;
         }
         idx += copyRun;
-        m_storeCtx_Run = PLTCtx(m_storeCtx_RunCopy);
+        m_storeCtxRun = PLTCtx(m_storeCtxRunCopy);
 
       }
       else
       {
         for (int runidx = 0; runidx <indexRun; runidx++)
         {
-          uint32_t posy = m_puiScanOrder[idx + runidx].y;
-          uint32_t posx = m_puiScanOrder[idx + runidx].x;
+          uint32_t posy = m_scanOrder[idx + runidx].y;
+          uint32_t posx = m_scanOrder[idx + runidx].x;
           runType.at(posx, posy) = PLT_RUN_INDEX;
           runLength.at(posx, posy) = indexRun;
         }
         idx += indexRun;
-        m_storeCtx_Run = PLTCtx(m_storeCtx_RunIndex);
+        m_storeCtxRun = PLTCtx(m_storeCtxRunIndex);
 
       }
     }
@@ -1673,7 +1673,7 @@ double IntraSearch::getRunBits(const CodingUnit&  cu, uint32_t run, uint32_t str
 
   m_CABACEstimator->resetBits();
   ///////////////// encode Run Type
-  m_CABACEstimator->encodeRunType(cu, runType, strPos, m_puiScanOrder, compBegin);
+  m_CABACEstimator->encodeRunType(cu, runType, strPos, m_scanOrder, compBegin);
   uint64_t runTypeBits = m_CABACEstimator->getEstFracBits();
   uint32_t curLevel = 0;
   switch (paletteRunMode)
@@ -1722,7 +1722,7 @@ void IntraSearch::preCalcPLTIndex(CodingStructure& cs, Partitioner& partitioner,
   }
 
   PelBuf   curPLTIdx = tu.getcurPLTIdx(compBegin);
-  int      errorLimit = numComp * g_uhPLTQuant[cu.qp];
+  int      errorLimit = numComp * g_paletteQuant[cu.qp];
   uint32_t bestIdx = 0;
   uint32_t scaleX = getComponentScaleX(COMPONENT_Cb, cs.sps->getChromaFormatIdc());
   uint32_t scaleY = getComponentScaleY(COMPONENT_Cb, cs.sps->getChromaFormatIdc());
@@ -1855,7 +1855,7 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner,
     }
   }
 
-  int errorLimit = g_uhPLTQuant[cu.qp];
+  int errorLimit = g_paletteQuant[cu.qp];
   uint32_t totalSize = height*width;
   SortingElement *pelList = new SortingElement[totalSize];
   SortingElement  element;
@@ -1900,7 +1900,7 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner,
       else
       {
         pelList[idx].copyDataFrom(element, compBegin, numComp);
-        pelList[idx].cnt = 1;
+        pelList[idx].setCnt(1);
         last = idx;
         idx++;
       }
@@ -1909,7 +1909,7 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner,
 
   for (int i = 0; i < dictMaxSize; i++)
   {
-    pelListSort[i].cnt = 0;
+    pelListSort[i].setCnt(0);
     pelListSort[i].resetAll(compBegin, numComp);
   }
 
@@ -1917,12 +1917,12 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner,
   dictMaxSize = 1;
   for (int i = 0; i < idx; i++)
   {
-    if (pelList[i].cnt > pelListSort[dictMaxSize - 1].cnt)
+    if (pelList[i].getCnt() > pelListSort[dictMaxSize - 1].getCnt())
     {
       int j;
       for (j = dictMaxSize; j > 0; j--)
       {
-        if (pelList[i].cnt > pelListSort[j - 1].cnt)
+        if (pelList[i].getCnt() > pelListSort[j - 1].getCnt() )
         {
           pelListSort[j].copyAllFrom(pelListSort[j - 1], compBegin, numComp);
           dictMaxSize = std::min(dictMaxSize + 1, (uint32_t)MAXPLTSIZE);
@@ -1946,12 +1946,12 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner,
   double bitCost = m_pcRdCost->getLambda()*numColorBits;
   for (int i = 0; i < MAXPLTSIZE; i++)
   {
-    if (pelListSort[i].cnt)
+    if (pelListSort[i].getCnt())
     {
-      int half = pelListSort[i].cnt >> 1;
+      int half = pelListSort[i].getCnt() >> 1;
       for (int comp = compBegin; comp < (compBegin + numComp); comp++)
       {
-        cu.curPLT[comp][paletteSize] = (pelListSort[i].sumData[comp] + half) / pelListSort[i].cnt;
+        cu.curPLT[comp][paletteSize] = (pelListSort[i].getSumData(comp) + half) / pelListSort[i].getCnt();
       }
 
       int best = -1;
@@ -1961,11 +1961,11 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner,
         for (int comp = compBegin; comp < (compBegin + numComp); comp++)
         {
           const int shift = (comp > 0) ? pcmShiftRight_C : pcmShiftRight_L;
-          pal[comp] = pelListSort[i].sumData[comp] / (double)pelListSort[i].cnt;
+          pal[comp] = pelListSort[i].getSumData(comp) / (double)pelListSort[i].getCnt();
           err = pal[comp] - cu.curPLT[comp][paletteSize];
           bestCost += (err*err) / (1 << (2 * shift));
         }
-        bestCost = bestCost * pelListSort[i].cnt + bitCost;
+        bestCost = bestCost * pelListSort[i].getCnt() + bitCost;
 
         for (int t = 0; t < cs.prevPLT.curPLTSize[compBegin]; t++)
         {
@@ -1976,7 +1976,7 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner,
             err = pal[comp] - cs.prevPLT.curPLT[comp][t];
             cost += (err*err) / (1 << (2 * shift));
           }
-          cost *= pelListSort[i].cnt;
+          cost *= pelListSort[i].getCnt();
           if (cost < bestCost)
           {
             best = t;
@@ -1993,7 +1993,7 @@ void IntraSearch::derivePLTLossy(CodingStructure& cs, Partitioner& partitioner,
       }
 
       bool duplicate = false;
-      if (pelListSort[i].cnt == 1 && best == -1)
+      if (pelListSort[i].getCnt() == 1 && best == -1)
       {
         duplicate = true;
       }
diff --git a/source/Lib/EncoderLib/IntraSearch.h b/source/Lib/EncoderLib/IntraSearch.h
index f7d5b46fbcce9ca76f7cc7c39c7d3d8cd123c451..d48ae95544732640b41d9d0ef908bde6f4ba4c35 100644
--- a/source/Lib/EncoderLib/IntraSearch.h
+++ b/source/Lib/EncoderLib/IntraSearch.h
@@ -68,9 +68,6 @@ enum PLTScanMode
 class SortingElement
 {
 public:
-  uint32_t cnt;
-  int data[3];
-  int shift, lastCnt, sumData[3];
   inline bool operator<(const SortingElement &other) const
   {
     return cnt > other.cnt;
@@ -80,7 +77,13 @@ public:
     data[0] = data[1] = data[2] = 0;
     sumData[0] = sumData[1] = sumData[2] = 0;
   }
-  void resetAll(ComponentID compBegin, uint32_t numComp) {
+  uint32_t  getCnt() const        { return cnt; }
+  void      setCnt(uint32_t val)  { cnt = val; }
+  int       getSumData (int id) const   { return sumData[id]; }
+  int       setSumData(int id, int val) { sumData[id] = val; }
+
+  void resetAll(ComponentID compBegin, uint32_t numComp) 
+  {
     shift = lastCnt = 0;
     for (int ch = compBegin; ch < (compBegin + numComp); ch++)
     {
@@ -88,7 +91,8 @@ public:
       sumData[ch] = 0;
     }
   }
-  void setAll(uint32_t* ui, ComponentID compBegin, uint32_t numComp) {
+  void setAll(uint32_t* ui, ComponentID compBegin, uint32_t numComp) 
+  {
     for (int ch = compBegin; ch < (compBegin + numComp); ch++)
     {
       data[ch] = ui[ch];
@@ -118,7 +122,8 @@ public:
     }
     return sumAd;
   }
-  void copyDataFrom(SortingElement element, ComponentID compBegin, uint32_t numComp) {
+  void copyDataFrom(SortingElement element, ComponentID compBegin, uint32_t numComp) 
+  {
     for (int comp = compBegin; comp < (compBegin + numComp); comp++)
     {
       data[comp] = element.data[comp];
@@ -126,7 +131,8 @@ public:
     }
     shift = 0; lastCnt = 1;
   }
-  void copyAllFrom(SortingElement element, ComponentID compBegin, uint32_t numComp) {
+  void copyAllFrom(SortingElement element, ComponentID compBegin, uint32_t numComp) 
+  {
     copyDataFrom(element, compBegin, numComp);
     cnt = element.cnt;
     for (int comp = compBegin; comp < (compBegin + numComp); comp++)
@@ -153,6 +159,9 @@ public:
       lastCnt = cnt;
     }
   }
+private: 
+  uint32_t cnt;
+  int shift, lastCnt, data[3], sumData[3];
 };
 #endif
 /// encoder search class