private void wait_until_safe() {
   while (!safe_modify) {
     // loop until safe to modify;
     try {
       Thread.sleep(1);
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
 }
 public void update() {
   // execute orders
   safe_modify = false;
   try {
     Thread.sleep(1);
   } catch (Exception ex) {
   }
   ;
   for (Spatial_Order order : orders) {
     try {
       execute(order);
     } catch (Exception ex) {
     }
     ;
   }
   orders.clear();
   safe_modify = true;
 }