Implementing a simple bubble sort