Add functionality to send messages to file