refactor main,config