add original fdr code and script to compute q