Better logging, some mistakes corrected