added collect_common_factors() (is this a good name?)