Improved functionality and logging