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