Logging and other tweaks