:bug: fixed some instances of wrong date ordering and optimised the timeseries code