Improved todo-list example (code refactoring)