write to file for CS