added parallel scan for segmented case