Selective commit from YNEZZ
Cleaned up main.c
Fixed RTC checks