Added temporary logging, switched from $data[2] to $headers