selecting logic