improve select alhorimtm for ELI retfunc