Added optimized version that properly checks intervals and does not load 2 full days of data