Added code to write log and read RTC