Pull msg function out, formatting.