optimize the select action