cleaned up getOrders code