Finish segment scanning logic.