moving functions to core