implement simple global selection handling #12
fix warnings and clean up