Logging and test improvements