[REF] (Selection) Small refactorings and cleanup on selection code