changed error handling + task order