_getActiveWindow function now properly determines active window based on stacking order. Logging calls cleaned up and additional calls added.
multi-instance and multi-display support.