Improved logging and comments