refine entity structure, using c like api