refactor and add watch task