Use activeNode and activeSelection.