Optimizing data management