Add maximal message count and fix ordering