Refactor todo sync