Split the messages.txt reading logic into its own file