improved time sorting, fixed item_revenue_data function