refactored todos controller