This commit may contains behavioural changes. - Fix for the issue with corrupted log displays - Wrap the activeDocument - Reduced potential type errors and strengthened certain checks - Made error handling more robust (by rewriting the error class)