reorganize hex.lua