Used an infinite loop instead for the bubblesort method