wrote factoring heuristics, all rules done. Still need to refactor