Refactoring to allow for message data source