Added functionality for getting historical data