refine the insert function