optimize data code