refactored task model and controller