Modified extract_source() and extract_target()