added egreedy func