Bubble Sort optimized