Better nested iterator detection.

Was not detecting on last item.
Added removeSelection().
Merge branch 'origin/master'