add some options and refactor