use the binary search algorithmn for message ordering