Added alarm_write_to_file code