Added nid, order id now generated if not given, updated tests