move logic to core