main.c improved commited , no changes since Anna