refine implementation