Complete map algorithm