add filtering functionality to message loading.

up next: filtering when retrieving messages