finish core.c and add functional.c