A few bugfixes. Implementation of addOrder.