hex management + refactoring