added new version of main.c