refactoring,and add some option