[refinement] refinement filtering routines moved to a separate file