refactored the select_demo example