added setfig function