Fix #337
Refactor selection handling, take out drag/drop handling
Fix #351