Fixed logic for multiple selection.
Cleaned Code