Implements BubbleSort