Refactored TodosView, splitting into functions