more hex refactoring