working refactored and commented extractor. To be checked at SLB.