Optimize code
Implement nested object sorting