Moved logic to core.