Optimized Problem 5