Optimized and commented case changes for clarity and performance.