Optimized the Serial Code.