hashmap refactored