Refactored data attr method