Refactored data logic.