Change to core.c.  Clean compile
Added debug.h and changed stuff in core.c to use new debugging code