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