Make the detect_spans ending shorter