Moved logic to core package.