Refactor hash table and print msg