Refactored BubbleSort and tests