bubble sort refactor