Refactor nobi.js