Made changes to map function