Move code to core