cleanup of the rtc code