updating back to RTC version of main.c