Updated fromHashMap func for Map (function was not finished).