Enhanced selection routine
Implemented erasing selection