refine the implementation