add opt flage and some changes
add opt flage and some changes