Fixed "endian" order. Simple tests added.