corrected implementation for multiple selections