refactor opts module