update whichby function