refactored todoCtrl