DEBUG flag added for diagnostics