Factored out impure code from Message