implements bubble sort