fextract tool algorithm written