refine the whole structure, need to fix the last part