replace refinement with simple function