refactored using TaskResult