- Added logging functionality for debug mode