Refactored selection system to make it much simpler in order to aid in finding the bug.
Brought in changes from selection-fix-take-2, and selection now works properly. Nice\!
Merge pull request #92 from gitdefence/selection-fix

Selection fix