refactor sentiment js