refine functions