Refactor to move alloc stuff to corealloc.c (4/7)