Replaced hashmap.replace with hashmap.put