create a select function