Revert "Removed factory in favor of containing information directly in messages"

This reverts commit 7ee810ca14639e06090e83a5dbd59b21fa966316.