Improved Array detection in getSelectedItems()