Finished getProcessedOrders function