Update mainfun.c

new changes