Some adjustments to the code for logging