Improved the bubble sort