fixed a client side bug for orders and reorganized the code for orders.