clean up code in record_string