writer improvements and initial debug test