improve extractor fn