changed way selection is handled
manually merged