slight modification in main.c