optimize endpoint select