update map algorithm