linked search main code