search_detect.R and search_split.R reorganized