repository function refine