added detection of selected node