added checking for current selection