add tail extracting code