Simplified the setup so that if rollover times change the script keeps working.