Code rework, more diagnostics