Changes to main.c and core.c