Moved some stuff from d to core