Restructuring data for better performance