Refactoring to use TaskService