Added raw data write function