refine the database