Add write_raw method