factor and refine