Small refactoring of message tracking code.