Refactoring of the todos route