Refactor messageList functions

Continuing work from last commit.