Moved core functions from runtime to core.c.