Refactored tasks_by_code_name method