Improved logging