Refactor messages selection from a topic.

Signed-off-by: Norv <a.w.norv@gmail.com>