more refactoring of hex