Added frame counter rollover detection. NOT TESTED