Refactor todo.js