Improved logging and documentation