TOOLS: Use endian for lab
TOOLS: Make unlab use lab.cpp and improve the lab.cpp code