Updated method for generating list from map