added pulldown menu for selection populations and refactored code