refine the code, remove some needless code