sorting messages properly.