Refactor the empty message criteria into its own method.

Removes plenty of duplication in the code