There is a paper on doing this.
Algorithm 1 FCFN in the paper does this very well.
I try to implement this algorithm as quickly as possible.
If you interested in this job, bid with your past work similar to this task.
I can believe you with your github infomation and hire you.